@copilotkit/runtime 1.3.14 → 1.3.16-mme-improve-langsmith.0
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/CHANGELOG.md +16 -0
- package/dist/{chunk-6TFW5P6C.mjs → chunk-E75MOZGE.mjs} +2 -2
- package/dist/{chunk-TOIJ5IIA.mjs → chunk-KCW3B5UA.mjs} +3 -3
- package/dist/{chunk-CPAHDRLS.mjs → chunk-MXXPWWBF.mjs} +4 -8
- package/dist/chunk-MXXPWWBF.mjs.map +1 -0
- package/dist/{chunk-HTQXEUKU.mjs → chunk-QJB3CIHI.mjs} +2 -2
- package/dist/{chunk-I5X63624.mjs → chunk-TD3UMHBH.mjs} +3 -3
- package/dist/chunk-TD3UMHBH.mjs.map +1 -0
- package/dist/{chunk-Y6RQG5HF.mjs → chunk-UHFZPBA5.mjs} +11 -6
- package/dist/chunk-UHFZPBA5.mjs.map +1 -0
- package/dist/{chunk-EN2GQDJF.mjs → chunk-YGFQK4XG.mjs} +2 -2
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/lib/index.js +13 -12
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +7 -7
- package/dist/lib/integrations/index.js +1 -1
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +5 -5
- package/dist/lib/integrations/nest/index.js +1 -1
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +3 -3
- package/dist/lib/integrations/node-express/index.js +1 -1
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +3 -3
- package/dist/lib/integrations/node-http/index.js +1 -1
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +2 -2
- package/dist/service-adapters/index.js +12 -11
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +2 -2
- package/package.json +4 -4
- package/src/service-adapters/google/google-genai-adapter.ts +2 -2
- package/src/service-adapters/langchain/langchain-adapter.ts +3 -2
- package/src/service-adapters/langchain/utils.ts +3 -7
- package/dist/chunk-CPAHDRLS.mjs.map +0 -1
- package/dist/chunk-I5X63624.mjs.map +0 -1
- package/dist/chunk-Y6RQG5HF.mjs.map +0 -1
- /package/dist/{chunk-6TFW5P6C.mjs.map → chunk-E75MOZGE.mjs.map} +0 -0
- /package/dist/{chunk-TOIJ5IIA.mjs.map → chunk-KCW3B5UA.mjs.map} +0 -0
- /package/dist/{chunk-HTQXEUKU.mjs.map → chunk-QJB3CIHI.mjs.map} +0 -0
- /package/dist/{chunk-EN2GQDJF.mjs.map → chunk-YGFQK4XG.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotRuntime,
|
|
3
3
|
flattenToolCallsNoDuplicates
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KCW3B5UA.mjs";
|
|
5
5
|
import {
|
|
6
6
|
AnthropicAdapter,
|
|
7
7
|
GoogleGenerativeAIAdapter,
|
|
@@ -11,25 +11,25 @@ import {
|
|
|
11
11
|
OpenAIAssistantAdapter,
|
|
12
12
|
RemoteChain,
|
|
13
13
|
UnifyAdapter
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UHFZPBA5.mjs";
|
|
15
15
|
import {
|
|
16
16
|
config,
|
|
17
17
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
18
18
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-QJB3CIHI.mjs";
|
|
20
20
|
import {
|
|
21
21
|
copilotRuntimeNestEndpoint
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-YGFQK4XG.mjs";
|
|
23
23
|
import {
|
|
24
24
|
copilotRuntimeNodeExpressEndpoint
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-E75MOZGE.mjs";
|
|
26
26
|
import {
|
|
27
27
|
buildSchema,
|
|
28
28
|
copilotRuntimeNodeHttpEndpoint,
|
|
29
29
|
createContext,
|
|
30
30
|
getCommonConfig
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
} from "./chunk-TD3UMHBH.mjs";
|
|
32
|
+
import "./chunk-MXXPWWBF.mjs";
|
|
33
33
|
import {
|
|
34
34
|
GuardrailsValidationFailureResponse,
|
|
35
35
|
MessageStreamInterruptedResponse,
|
package/dist/lib/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var require_package = __commonJS({
|
|
|
44
44
|
publishConfig: {
|
|
45
45
|
access: "public"
|
|
46
46
|
},
|
|
47
|
-
version: "1.3.
|
|
47
|
+
version: "1.3.16-mme-improve-langsmith.0",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -500,7 +500,7 @@ function convertJsonSchemaToZodSchema(jsonSchema, required) {
|
|
|
500
500
|
for (const [key, value] of Object.entries(jsonSchema.properties)) {
|
|
501
501
|
spec[key] = convertJsonSchemaToZodSchema(value, jsonSchema.required ? jsonSchema.required.includes(key) : false);
|
|
502
502
|
}
|
|
503
|
-
let schema = import_zod.z.object(spec);
|
|
503
|
+
let schema = import_zod.z.object(spec).describe(jsonSchema.description);
|
|
504
504
|
return required ? schema : schema.optional();
|
|
505
505
|
} else if (jsonSchema.type === "string") {
|
|
506
506
|
let schema = import_zod.z.string().describe(jsonSchema.description);
|
|
@@ -513,7 +513,7 @@ function convertJsonSchemaToZodSchema(jsonSchema, required) {
|
|
|
513
513
|
return required ? schema : schema.optional();
|
|
514
514
|
} else if (jsonSchema.type === "array") {
|
|
515
515
|
let itemSchema = convertJsonSchemaToZodSchema(jsonSchema.items, true);
|
|
516
|
-
let schema = import_zod.z.array(itemSchema);
|
|
516
|
+
let schema = import_zod.z.array(itemSchema).describe(jsonSchema.description);
|
|
517
517
|
return required ? schema : schema.optional();
|
|
518
518
|
}
|
|
519
519
|
}
|
|
@@ -589,8 +589,6 @@ async function streamLangChainResponse({ result, eventStream$, actionExecution }
|
|
|
589
589
|
let toolCallName = void 0;
|
|
590
590
|
let toolCallId = void 0;
|
|
591
591
|
let toolCallArgs = void 0;
|
|
592
|
-
let toolCallIndex = void 0;
|
|
593
|
-
let toolCallPrevIndex = void 0;
|
|
594
592
|
let hasToolCall = false;
|
|
595
593
|
let content = value == null ? void 0 : value.content;
|
|
596
594
|
if (isAIMessageChunk(value)) {
|
|
@@ -608,8 +606,6 @@ async function streamLangChainResponse({ result, eventStream$, actionExecution }
|
|
|
608
606
|
toolCallDetails.id = chunk.index != null ? `${chunk.id}-idx-${chunk.index}` : chunk.id;
|
|
609
607
|
toolCallName = toolCallDetails.name;
|
|
610
608
|
toolCallId = toolCallDetails.id;
|
|
611
|
-
toolCallIndex = toolCallDetails.index;
|
|
612
|
-
toolCallPrevIndex = toolCallDetails.prevIndex;
|
|
613
609
|
} else if (isBaseMessageChunk(value)) {
|
|
614
610
|
let chunk = (_f = (_e = value.additional_kwargs) == null ? void 0 : _e.tool_calls) == null ? void 0 : _f[0];
|
|
615
611
|
toolCallName = (_g = chunk == null ? void 0 : chunk.function) == null ? void 0 : _g.name;
|
|
@@ -639,7 +635,7 @@ async function streamLangChainResponse({ result, eventStream$, actionExecution }
|
|
|
639
635
|
if (mode === "message" && content) {
|
|
640
636
|
eventStream$.sendTextMessageContent(Array.isArray(content) ? ((_i = content[0]) == null ? void 0 : _i.text) ?? "" : content);
|
|
641
637
|
} else if (mode === "function" && toolCallArgs) {
|
|
642
|
-
if (
|
|
638
|
+
if (toolCallDetails.index !== toolCallDetails.prevIndex) {
|
|
643
639
|
eventStream$.sendActionExecutionEnd();
|
|
644
640
|
eventStream$.sendActionExecutionStart(toolCallId, toolCallName);
|
|
645
641
|
toolCallDetails.prevIndex = toolCallDetails.index;
|
|
@@ -681,7 +677,8 @@ var LangChainAdapter = class {
|
|
|
681
677
|
this.options = options;
|
|
682
678
|
}
|
|
683
679
|
async process(request) {
|
|
684
|
-
const { eventSource, model, actions, messages,
|
|
680
|
+
const { eventSource, model, actions, messages, runId } = request;
|
|
681
|
+
const threadId = request.threadId ?? (0, import_shared3.randomId)();
|
|
685
682
|
const result = await this.options.chainFn({
|
|
686
683
|
messages: messages.map(convertMessageToLangChainMessage),
|
|
687
684
|
tools: actions.map(convertActionInputToLangChainTool),
|
|
@@ -696,7 +693,7 @@ var LangChainAdapter = class {
|
|
|
696
693
|
});
|
|
697
694
|
});
|
|
698
695
|
return {
|
|
699
|
-
threadId
|
|
696
|
+
threadId
|
|
700
697
|
};
|
|
701
698
|
}
|
|
702
699
|
};
|
|
@@ -707,12 +704,16 @@ var import_google_gauth = require("@langchain/google-gauth");
|
|
|
707
704
|
var GoogleGenerativeAIAdapter = class extends LangChainAdapter {
|
|
708
705
|
constructor(options) {
|
|
709
706
|
super({
|
|
710
|
-
chainFn: async ({ messages, tools }) => {
|
|
707
|
+
chainFn: async ({ messages, tools, threadId }) => {
|
|
711
708
|
const model = new import_google_gauth.ChatGoogle({
|
|
712
709
|
modelName: (options == null ? void 0 : options.model) ?? "gemini-1.5-pro",
|
|
713
710
|
apiVersion: "v1beta"
|
|
714
711
|
}).bindTools(tools);
|
|
715
|
-
return model.stream(messages
|
|
712
|
+
return model.stream(messages, {
|
|
713
|
+
metadata: {
|
|
714
|
+
conversation_id: threadId
|
|
715
|
+
}
|
|
716
|
+
});
|
|
716
717
|
}
|
|
717
718
|
});
|
|
718
719
|
}
|