11import { LDAIConfigTracker } from './LDAIConfigTracker' ;
22import { VercelAISDKConfig , VercelAISDKMapOptions , VercelAISDKProvider } from './VercelAISDK' ;
33
4+ // ============================================================================
5+ // Foundation Types
6+ // ============================================================================
7+
8+ /**
9+ * Information about prompts.
10+ */
11+ export interface LDMessage {
12+ /**
13+ * The role of the prompt.
14+ */
15+ role : 'user' | 'assistant' | 'system' ;
16+ /**
17+ * Content for the prompt.
18+ */
19+ content : string ;
20+ }
21+
422/**
523 * Configuration related to the model.
624 */
@@ -28,6 +46,10 @@ export interface LDProviderConfig {
2846 name : string ;
2947}
3048
49+ // ============================================================================
50+ // Judge Types
51+ // ============================================================================
52+
3153/**
3254 * Configuration for a single judge attachment.
3355 */
@@ -46,6 +68,30 @@ export interface LDJudgeConfiguration {
4668 judges : LDJudge [ ] ;
4769}
4870
71+ // ============================================================================
72+ // Base AI Config Types
73+ // ============================================================================
74+
75+ /**
76+ * Base AI Config interface for default implementations with optional enabled property.
77+ */
78+ export interface LDAIConfigDefault {
79+ /**
80+ * Optional model configuration.
81+ */
82+ model ?: LDModelConfig ;
83+
84+ /**
85+ * Optional configuration for the provider.
86+ */
87+ provider ?: LDProviderConfig ;
88+
89+ /**
90+ * Whether the configuration is enabled. Defaults to false when not provided.
91+ */
92+ enabled ?: boolean ;
93+ }
94+
4995/**
5096 * Base AI Config interface without mode-specific fields.
5197 */
@@ -81,44 +127,9 @@ export interface LDAIConfig extends Omit<LDAIConfigDefault, 'enabled'> {
81127 ) => VercelAISDKConfig < TMod > ;
82128}
83129
84- /**
85- * Base AI Config interface for default implementations with optional enabled property.
86- */
87- export interface LDAIConfigDefault {
88- /**
89- * Optional model configuration.
90- */
91- model ?: LDModelConfig ;
92-
93- /**
94- * Optional configuration for the provider.
95- */
96- provider ?: LDProviderConfig ;
97-
98- /**
99- * Whether the configuration is enabled. Defaults to false when not provided.
100- */
101- enabled ?: boolean ;
102- }
103-
104- /**
105- * Default implementation types for AI Configs with optional enabled property.
106- */
107-
108- /**
109- * Default Judge-specific AI Config with required evaluation metric key.
110- */
111- export interface LDAIJudgeConfigDefault extends LDAIConfigDefault {
112- /**
113- * Optional prompt data for judge configurations.
114- */
115- messages ?: LDMessage [ ] ;
116- /**
117- * Evaluation metric keys for judge configurations.
118- * The keys of the metrics that this judge can evaluate.
119- */
120- evaluationMetricKeys ?: string [ ] ;
121- }
130+ // ============================================================================
131+ // Default AI Config Implementation Types
132+ // ============================================================================
122133
123134/**
124135 * Default Agent-specific AI Config with instructions.
@@ -151,13 +162,9 @@ export interface LDAICompletionConfigDefault extends LDAIConfigDefault {
151162}
152163
153164/**
154- * Non-default implementation types for AI Configs with required enabled property and tracker.
155- */
156-
157- /**
158- * Judge-specific AI Config with required evaluation metric key.
165+ * Default Judge-specific AI Config with required evaluation metric key.
159166 */
160- export interface LDAIJudgeConfig extends LDAIConfig {
167+ export interface LDAIJudgeConfigDefault extends LDAIConfigDefault {
161168 /**
162169 * Optional prompt data for judge configurations.
163170 */
@@ -166,9 +173,21 @@ export interface LDAIJudgeConfig extends LDAIConfig {
166173 * Evaluation metric keys for judge configurations.
167174 * The keys of the metrics that this judge can evaluate.
168175 */
169- evaluationMetricKeys : string [ ] ;
176+ evaluationMetricKeys ? : string [ ] ;
170177}
171178
179+ /**
180+ * Union type for all default AI Config variants.
181+ */
182+ export type LDAIConfigDefaultKind =
183+ | LDAIAgentConfigDefault
184+ | LDAICompletionConfigDefault
185+ | LDAIJudgeConfigDefault ;
186+
187+ // ============================================================================
188+ // AI Config Implementation Types
189+ // ============================================================================
190+
172191/**
173192 * Agent-specific AI Config with instructions.
174193 */
@@ -200,31 +219,32 @@ export interface LDAICompletionConfig extends LDAIConfig {
200219}
201220
202221/**
203- * Information about prompts .
222+ * Judge-specific AI Config with required evaluation metric key .
204223 */
205- export interface LDMessage {
224+ export interface LDAIJudgeConfig extends LDAIConfig {
206225 /**
207- * The role of the prompt .
226+ * Optional prompt data for judge configurations .
208227 */
209- role : 'user' | 'assistant' | 'system' ;
228+ messages ?: LDMessage [ ] ;
210229 /**
211- * Content for the prompt.
230+ * Evaluation metric keys for judge configurations.
231+ * The keys of the metrics that this judge can evaluate.
212232 */
213- content : string ;
233+ evaluationMetricKeys : string [ ] ;
214234}
215235
236+ // ============================================================================
237+ // Union Types
238+ // ============================================================================
239+
216240/**
217241 * Union type for all AI Config variants.
218242 */
219- export type LDAIConfigKind = LDAICompletionConfig | LDAIAgentConfig | LDAIJudgeConfig ;
243+ export type LDAIConfigKind = LDAIAgentConfig | LDAICompletionConfig | LDAIJudgeConfig ;
220244
221- /**
222- * Union type for all default AI Config variants.
223- */
224- export type LDAIConfigDefaultKind =
225- | LDAICompletionConfigDefault
226- | LDAIAgentConfigDefault
227- | LDAIJudgeConfigDefault ;
245+ // ============================================================================
246+ // Agent-Specific Request Type
247+ // ============================================================================
228248
229249/**
230250 * Configuration for a single agent request.
@@ -246,15 +266,9 @@ export interface LDAIAgentRequestConfig {
246266 variables ?: Record < string , unknown > ;
247267}
248268
249- /**
250- * AI Config agent interface (extends agent config without tracker and toVercelAISDK).
251- */
252- export interface LDAIAgent extends Omit < LDAIAgentConfig , 'toVercelAISDK' | 'tracker' > {
253- /**
254- * Instructions for the agent.
255- */
256- instructions ?: string ;
257- }
269+ // ============================================================================
270+ // Mode Type
271+ // ============================================================================
258272
259273/**
260274 * Mode type for AI configurations.
0 commit comments