illuma-agents 1.0.53 → 1.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/graphs/Graph.cjs +23 -4
- package/dist/cjs/graphs/Graph.cjs.map +1 -1
- package/dist/cjs/llm/bedrock/index.cjs +15 -0
- package/dist/cjs/llm/bedrock/index.cjs.map +1 -1
- package/dist/esm/graphs/Graph.mjs +23 -4
- package/dist/esm/graphs/Graph.mjs.map +1 -1
- package/dist/esm/llm/bedrock/index.mjs +15 -0
- package/dist/esm/llm/bedrock/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/graphs/Graph.ts +25 -4
- package/src/llm/bedrock/index.ts +18 -0
package/package.json
CHANGED
package/src/graphs/Graph.ts
CHANGED
|
@@ -764,30 +764,51 @@ export class StandardGraph extends Graph<t.BaseGraphState, t.GraphNode> {
|
|
|
764
764
|
}
|
|
765
765
|
|
|
766
766
|
// Use withStructuredOutput to bind the schema
|
|
767
|
+
// Always use includeRaw: true internally so we can debug what's returned
|
|
767
768
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
768
769
|
const structuredModel = (model as any).withStructuredOutput(schema, {
|
|
769
770
|
name,
|
|
770
771
|
method,
|
|
771
|
-
includeRaw,
|
|
772
|
+
includeRaw: true, // Always true internally for debugging
|
|
772
773
|
strict: structuredOutputConfig.strict !== false,
|
|
773
774
|
});
|
|
774
775
|
|
|
776
|
+
console.log('[Graph] Structured output config:', {
|
|
777
|
+
name,
|
|
778
|
+
method,
|
|
779
|
+
provider,
|
|
780
|
+
schemaKeys: Object.keys(schema),
|
|
781
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
782
|
+
modelName: (model as any).model || (model as any).modelId || 'unknown',
|
|
783
|
+
});
|
|
784
|
+
|
|
775
785
|
let lastError: Error | undefined;
|
|
776
786
|
let attempts = 0;
|
|
777
787
|
|
|
778
788
|
while (attempts <= maxRetries) {
|
|
779
789
|
try {
|
|
780
790
|
const result = await structuredModel.invoke(finalMessages, config);
|
|
791
|
+
|
|
792
|
+
// Debug: log what we got back
|
|
793
|
+
console.log('[Graph] Structured output raw result type:', typeof result);
|
|
794
|
+
if (result?.raw) {
|
|
795
|
+
const rawMsg = result.raw;
|
|
796
|
+
console.log('[Graph] Raw message content type:', typeof rawMsg?.content);
|
|
797
|
+
console.log('[Graph] Raw message tool_calls:', rawMsg?.tool_calls?.length ?? 0);
|
|
798
|
+
if (rawMsg?.content && typeof rawMsg.content === 'string' && rawMsg.content.length > 0) {
|
|
799
|
+
console.log('[Graph] Raw message text content (first 200):', rawMsg.content.substring(0, 200));
|
|
800
|
+
}
|
|
801
|
+
}
|
|
781
802
|
|
|
782
|
-
// Handle includeRaw
|
|
783
|
-
if (
|
|
803
|
+
// Handle response - we always use includeRaw internally
|
|
804
|
+
if (result?.raw && result?.parsed !== undefined) {
|
|
784
805
|
return {
|
|
785
806
|
structuredResponse: result.parsed as Record<string, unknown>,
|
|
786
807
|
rawMessage: result.raw as AIMessageChunk,
|
|
787
808
|
};
|
|
788
809
|
}
|
|
789
810
|
|
|
790
|
-
//
|
|
811
|
+
// Fallback for models that don't support includeRaw
|
|
791
812
|
return {
|
|
792
813
|
structuredResponse: result as Record<string, unknown>,
|
|
793
814
|
};
|
package/src/llm/bedrock/index.ts
CHANGED
|
@@ -101,6 +101,24 @@ export class CustomChatBedrockConverse extends ChatBedrockConverse {
|
|
|
101
101
|
this.promptCache = fields?.promptCache ?? false;
|
|
102
102
|
this.applicationInferenceProfile = fields?.applicationInferenceProfile;
|
|
103
103
|
this.serviceTier = fields?.serviceTier;
|
|
104
|
+
|
|
105
|
+
// Fix: Force supportsToolChoiceValues for Claude models
|
|
106
|
+
// The parent constructor checks `model.includes('claude-3')` but this fails when:
|
|
107
|
+
// 1. Using applicationInferenceProfile ARNs (arn:aws:bedrock:...)
|
|
108
|
+
// 2. Using different naming conventions (claude-4, claude-opus-4, etc.)
|
|
109
|
+
// We need to ensure tool_choice is properly set for withStructuredOutput to work
|
|
110
|
+
const modelName = (fields?.model ?? '').toLowerCase();
|
|
111
|
+
const profileName = (fields?.applicationInferenceProfile ?? '').toLowerCase();
|
|
112
|
+
const isClaudeModel =
|
|
113
|
+
modelName.includes('claude') ||
|
|
114
|
+
modelName.includes('anthropic') ||
|
|
115
|
+
profileName.includes('claude') ||
|
|
116
|
+
profileName.includes('anthropic');
|
|
117
|
+
|
|
118
|
+
if (isClaudeModel && !this.supportsToolChoiceValues?.length) {
|
|
119
|
+
// Claude models support all tool choice values
|
|
120
|
+
this.supportsToolChoiceValues = ['auto', 'any', 'tool'];
|
|
121
|
+
}
|
|
104
122
|
}
|
|
105
123
|
|
|
106
124
|
static lc_name(): string {
|