Overview

A ConfigType consists of the following main components:

providerName
string

Name of the LLM provider.

Constraints: minimum 1 character.

providerId
string

Adaline internal UUID for provider.

Constraints: minimum 1 character.

model
string

Model name to use for the prompt.

Constraints: minimum 1 character.

settings
object

Runtime configuration settings.

Constraints: flexible key-value pairs.

Field Details

providerName
string

Specifies the name of the LLM provider to use for prompt execution.

Constraints: minimum 1 character.

Examples: "openai", "anthropic", "google"

providerId
string

Adaline internal UUID for specific provider, useful when working with multiple providers aka if you have created multiple providers in Adaline.

Constraints: minimum 1 character.

Example: "6e94350a-95a9-48e7-8eab-a9f35ec2dc9d"

model
string

Specifies which model to use within the selected provider.

Constraints: minimum 1 character.

Examples: "gpt-4o", "claude-3-sonnet", "gemini-pro"

settings
object

Flexible configuration settings that are passed to the LLM provider. These settings are provider-specific and can include parameters like temperature, max tokens, etc.

Key-value pairs for provider-specific settings.

Constraints: flexible record.

This allows for any provider-specific configuration parameters.

Complete Examples

const config = {
  providerName: "openai",
  providerId: "6e94350a-95a9-48e7-8eab-a9f35ec2dc9d",
  model: "gpt-4o",
  settings: { 
    temperature: 0.7,
    maxTokens: 1000,
    topP: 0.9,
    presencePenalty: 0.1,
  },
};
const config = {
  providerName: "anthropic",
  providerId: "6e94350a-95a9-48e7-8eab-a9f35ec2dc9d",
  model: "claude-3-sonnet-20240229",
  settings: {
    temperature: 0.3,
    maxTokens: 2000,
    topK: 40,
    topP: 0.95,
    stopSequences: ["\n\nHuman:", "\n\nAssistant:"],
  },
};

ResponseSchemaType

The ResponseSchemaType provides structured response formatting for prompts. This is optional and used when you want to enforce a specific output structure from the LLM.

ResponseSchemaType Structure

name
string

Schema name identifier.

Constraints: 1-64 characters, alphanumeric and underscore only.

description
string

Schema description.

Constraints: Maximum 4096 characters.

strict
boolean

Enforce strict schema validation.

Constraints: Optional field.

schema
ResponseSchemaStructureType

The actual schema definition.

Constraints: Must be valid object schema.

Schema Name Validation

The schema name follows the rules:

  • Length: 1-64 characters
  • Characters: Only letters (a-z, A-Z), numbers (0-9), and underscores (_)
  • Pattern: ^[a-zA-Z0-9_]{1,64}$

ResponseSchemaStructureType

type
"object"

Schema type.

Constraints: Must be "object"

required
Array<string>

Required property names.

Constraints: List of required fields.

$defs
Record<string, any>

Schema definitions.

Constraints: Optional, for reusable components.

properties
Record<string, ResponseSchemaPropertyType>

Property definitions.

Constraints: Object property schemas.

additionalProperties
false

Disallow additional properties.

Constraints: Must be false

ResponseSchemaPropertyType

Individual property definitions support comprehensive JSON Schema features:

anyOf
Array<any>

Union type definitions.

Constraints: Optional field.

type
ResponseSchemaTypesType | Array

Property data type.

Constraints: See supported types below.

default
any

Default value.

Constraints: Optional field.

title
string

Property title.

Constraints: Optional field.

description
string

Property description.

Constraints: Maximum 4096 characters.

properties
Record<string, any>

Nested object properties.

Constraints: Optional, for object types

required
Array<string>

Required nested properties.

Constraints: Optional, for object types

minItems
number

Minimum array length.

Constraints: Optional, for array types

maxItems
number

Maximum array length.

Constraints: Optional, for array types

items
Record<string, any>

Array item schema.

Constraints: Optional, for array types

enum
Array<string | number | boolean | null>

Allowed values.

Constraints: Optional field.

minimum
number

Minimum numeric value.

Constraints: Optional, for number types

maximum
number

Maximum numeric value.

Constraints: Optional, for number types

minLength
number

Minimum string length.

Constraints: Optional, for string types

maxLength
number

Maximum string length.

Constraints: Optional, for string types

$ref
string

Reference to another schema.

Constraints: Optional field.

Supported Response Schema Types

"object"
string

Object/dictionary type.

Usage: For complex nested structures.

"array"
string

Array type.

Usage: For lists of items.

"number"
string

Numeric type.

Usage: For integers and floating-point numbers.

"string"
string

String type.

Usage: For text values.

"boolean"
string

Boolean type.

Usage: For true/false values.

"enum"
string

Enumeration type.

Usage: For predefined value sets.

Response Schema Example

const responseSchema = {
  name: "user_analysis",
  description: "Analysis result for user data",
  strict: true,
  schema: {
    type: "object",
    required: ["user_id", "analysis_type", "results"],
    properties: {
      user_id: {
        type: "string",
        description: "Unique identifier for the user",
      },
      analysis_type: {
        type: "string",
        enum: ["basic", "detailed", "comprehensive"],
        description: "Type of analysis performed",
      },
      results: {
        type: "object",
        properties: {
          score: {
            type: "number",
            minimum: 0,
            maximum: 100,
            description: "Analysis score",
          },
          categories: {
            type: "array",
            items: {
              type: "string",
            },
            minItems: 1,
            description: "Relevant categories",
          },
          confidence: {
            type: "number",
            minimum: 0,
            maximum: 1,
            description: "Confidence level",
          },
        },
        required: ["score", "confidence"],
        additionalProperties: false,
      },
    },
    additionalProperties: false,
  },
};

const config = {
  providerName: "openai",
  providerId: "6e94350a-95a9-48e7-8eab-a9f35ec2dc9d",
  model: "gpt-4o",
  settings: {
    temperature: 0.2,
    maxTokens: 2000,
    topP: 0.95,
    presencePenalty: 0.1,
    frequencyPenalty: 0.1,
    responseFormat: {
      type: "json_schema",
      schema: responseSchema,
    },
  },
};