Overview
A ConfigType
consists of the following main components:
Name of the LLM provider.Constraints: minimum 1 character.
Adaline internal UUID for provider.Constraints: minimum 1 character.
Model name to use for the prompt.Constraints: minimum 1 character.
Runtime configuration settings.Constraints: flexible key-value pairs.
Field Details
Specifies the name of the LLM provider to use for prompt execution.Constraints: minimum 1 character.Examples: "openai"
, "anthropic"
, "google"
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"
Specifies which model to use within the selected provider.Constraints: minimum 1 character.Examples: "gpt-4o"
, "claude-3-sonnet"
, "gemini-pro"
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
Schema name identifier.Constraints: 1-64 characters, alphanumeric and underscore only.
Schema description.Constraints: Maximum 4096 characters.
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
Schema type.Constraints: Must be "object"
Required property names.Constraints: List of required fields.
Schema definitions.Constraints: Optional, for reusable components.
properties
Record<string, ResponseSchemaPropertyType>
Property definitions.Constraints: Object property schemas.
Disallow additional properties.Constraints: Must be false
ResponseSchemaPropertyType
Individual property definitions support comprehensive JSON Schema features:
Union type definitions.Constraints: Optional field.
type
ResponseSchemaTypesType | Array
Property data type.Constraints: See supported types below.
Default value.Constraints: Optional field.
Property title.Constraints: Optional field.
Property description.Constraints: Maximum 4096 characters.
Nested object properties.Constraints: Optional, for object types
Required nested properties.Constraints: Optional, for object types
Minimum array length.Constraints: Optional, for array types
Maximum array length.Constraints: Optional, for array types
Array item schema.Constraints: Optional, for array types
enum
Array<string | number | boolean | null>
Allowed values.Constraints: Optional field.
Minimum numeric value.Constraints: Optional, for number types
Maximum numeric value.Constraints: Optional, for number types
Minimum string length.Constraints: Optional, for string types
Maximum string length.Constraints: Optional, for string types
Reference to another schema.Constraints: Optional field.
Supported Response Schema Types
Object/dictionary type.Usage: For complex nested structures.
Array type.Usage: For lists of items.
Numeric type.Usage: For integers and floating-point numbers.
String type.Usage: For text values.
Boolean type.Usage: For true/false values.
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,
},
},
};