@copilotkit/runtime 1.3.16-mme-reset-chat.2 → 1.3.16-mme-azure-openai.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +3 -19
  2. package/dist/{chunk-SMVZ2NQP.mjs → chunk-BHSRGDL6.mjs} +22 -29
  3. package/dist/chunk-BHSRGDL6.mjs.map +1 -0
  4. package/dist/{chunk-7LIN2NIO.mjs → chunk-CRSCH25P.mjs} +2 -2
  5. package/dist/{chunk-KFO5XSPV.mjs → chunk-MKZBH3Y6.mjs} +2 -2
  6. package/dist/{chunk-STQIVH2M.mjs → chunk-MVG266E4.mjs} +3 -3
  7. package/dist/{chunk-AXHCROTL.mjs → chunk-S5SYJ6JC.mjs} +2 -2
  8. package/dist/{chunk-DX45O7PM.mjs → chunk-YVZORQSA.mjs} +2 -2
  9. package/dist/chunk-YVZORQSA.mjs.map +1 -0
  10. package/dist/{groq-adapter-b122e71f.d.ts → groq-adapter-798aff23.d.ts} +36 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +22 -29
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.mjs +6 -6
  15. package/dist/lib/index.d.ts +1 -1
  16. package/dist/lib/index.js +22 -29
  17. package/dist/lib/index.js.map +1 -1
  18. package/dist/lib/index.mjs +6 -6
  19. package/dist/lib/integrations/index.js +1 -1
  20. package/dist/lib/integrations/index.js.map +1 -1
  21. package/dist/lib/integrations/index.mjs +4 -4
  22. package/dist/lib/integrations/nest/index.js +1 -1
  23. package/dist/lib/integrations/nest/index.js.map +1 -1
  24. package/dist/lib/integrations/nest/index.mjs +2 -2
  25. package/dist/lib/integrations/node-express/index.js +1 -1
  26. package/dist/lib/integrations/node-express/index.js.map +1 -1
  27. package/dist/lib/integrations/node-express/index.mjs +2 -2
  28. package/dist/lib/integrations/node-http/index.js +1 -1
  29. package/dist/lib/integrations/node-http/index.js.map +1 -1
  30. package/dist/lib/integrations/node-http/index.mjs +1 -1
  31. package/dist/service-adapters/index.d.ts +1 -1
  32. package/dist/service-adapters/index.js +21 -28
  33. package/dist/service-adapters/index.js.map +1 -1
  34. package/dist/service-adapters/index.mjs +1 -1
  35. package/package.json +4 -4
  36. package/src/service-adapters/google/google-genai-adapter.ts +2 -2
  37. package/src/service-adapters/langchain/langchain-adapter.ts +19 -23
  38. package/src/service-adapters/openai/openai-adapter.ts +37 -0
  39. package/dist/chunk-DX45O7PM.mjs.map +0 -1
  40. package/dist/chunk-SMVZ2NQP.mjs.map +0 -1
  41. /package/dist/{chunk-7LIN2NIO.mjs.map → chunk-CRSCH25P.mjs.map} +0 -0
  42. /package/dist/{chunk-KFO5XSPV.mjs.map → chunk-MKZBH3Y6.mjs.map} +0 -0
  43. /package/dist/{chunk-STQIVH2M.mjs.map → chunk-MVG266E4.mjs.map} +0 -0
  44. /package/dist/{chunk-AXHCROTL.mjs.map → chunk-S5SYJ6JC.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-STQIVH2M.mjs";
4
+ } from "./chunk-MVG266E4.mjs";
5
5
  import {
6
6
  AnthropicAdapter,
7
7
  GoogleGenerativeAIAdapter,
@@ -11,24 +11,24 @@ import {
11
11
  OpenAIAssistantAdapter,
12
12
  RemoteChain,
13
13
  UnifyAdapter
14
- } from "./chunk-SMVZ2NQP.mjs";
14
+ } from "./chunk-BHSRGDL6.mjs";
15
15
  import {
16
16
  config,
17
17
  copilotRuntimeNextJSAppRouterEndpoint,
18
18
  copilotRuntimeNextJSPagesRouterEndpoint
19
- } from "./chunk-7LIN2NIO.mjs";
19
+ } from "./chunk-CRSCH25P.mjs";
20
20
  import {
21
21
  copilotRuntimeNestEndpoint
22
- } from "./chunk-KFO5XSPV.mjs";
22
+ } from "./chunk-MKZBH3Y6.mjs";
23
23
  import {
24
24
  copilotRuntimeNodeExpressEndpoint
25
- } from "./chunk-AXHCROTL.mjs";
25
+ } from "./chunk-S5SYJ6JC.mjs";
26
26
  import {
27
27
  buildSchema,
28
28
  copilotRuntimeNodeHttpEndpoint,
29
29
  createContext,
30
30
  getCommonConfig
31
- } from "./chunk-DX45O7PM.mjs";
31
+ } from "./chunk-YVZORQSA.mjs";
32
32
  import "./chunk-MXXPWWBF.mjs";
33
33
  import {
34
34
  GuardrailsValidationFailureResponse,
@@ -1,5 +1,5 @@
1
1
  export { g as CommonConfig, b as CopilotRequestContextProperties, a as CopilotRuntime, C as CopilotRuntimeConstructorParams, c as CreateCopilotRuntimeServerOptions, G as GraphQLContext, e as buildSchema, d as createContext, f as flattenToolCallsNoDuplicates, h as getCommonConfig } from '../copilot-runtime-df3527ad.js';
2
- export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from '../groq-adapter-b122e71f.js';
2
+ export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from '../groq-adapter-798aff23.js';
3
3
  export { CopilotRuntimeServerInstance, config, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint } from './integrations/index.js';
4
4
  export { copilotRuntimeNodeHttpEndpoint } from './integrations/node-http/index.js';
5
5
  export { copilotRuntimeNodeExpressEndpoint } from './integrations/node-express/index.js';
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.16-mme-reset-chat.2",
47
+ version: "1.3.16-mme-azure-openai.0",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -420,6 +420,9 @@ var OpenAIAdapter = class {
420
420
  var _a, _b;
421
421
  let mode = null;
422
422
  for await (const chunk of stream) {
423
+ if (chunk.choices.length === 0) {
424
+ continue;
425
+ }
423
426
  const toolCall = (_a = chunk.choices[0].delta.tool_calls) == null ? void 0 : _a[0];
424
427
  const content = chunk.choices[0].delta.content;
425
428
  if (mode === "message" && (toolCall == null ? void 0 : toolCall.id)) {
@@ -668,7 +671,6 @@ __name(encodeResult, "encodeResult");
668
671
 
669
672
  // src/service-adapters/langchain/langchain-adapter.ts
670
673
  var import_shared3 = require("@copilotkit/shared");
671
- var import_promises = require("@langchain/core/callbacks/promises");
672
674
  var LangChainAdapter = class {
673
675
  options;
674
676
  /**
@@ -678,28 +680,23 @@ var LangChainAdapter = class {
678
680
  this.options = options;
679
681
  }
680
682
  async process(request) {
681
- try {
682
- const { eventSource, model, actions, messages, runId } = request;
683
- const threadId = request.threadId ?? (0, import_shared3.randomId)();
684
- const result = await this.options.chainFn({
685
- messages: messages.map(convertMessageToLangChainMessage),
686
- tools: actions.map(convertActionInputToLangChainTool),
687
- model,
688
- threadId,
689
- runId
690
- });
691
- eventSource.stream(async (eventStream$) => {
692
- await streamLangChainResponse({
693
- result,
694
- eventStream$
695
- });
683
+ const { eventSource, model, actions, messages, threadId, runId } = request;
684
+ const result = await this.options.chainFn({
685
+ messages: messages.map(convertMessageToLangChainMessage),
686
+ tools: actions.map(convertActionInputToLangChainTool),
687
+ model,
688
+ threadId,
689
+ runId
690
+ });
691
+ eventSource.stream(async (eventStream$) => {
692
+ await streamLangChainResponse({
693
+ result,
694
+ eventStream$
696
695
  });
697
- return {
698
- threadId
699
- };
700
- } finally {
701
- await (0, import_promises.awaitAllCallbacks)();
702
- }
696
+ });
697
+ return {
698
+ threadId: threadId || (0, import_shared3.randomId)()
699
+ };
703
700
  }
704
701
  };
705
702
  __name(LangChainAdapter, "LangChainAdapter");
@@ -709,16 +706,12 @@ var import_google_gauth = require("@langchain/google-gauth");
709
706
  var GoogleGenerativeAIAdapter = class extends LangChainAdapter {
710
707
  constructor(options) {
711
708
  super({
712
- chainFn: async ({ messages, tools, threadId }) => {
709
+ chainFn: async ({ messages, tools }) => {
713
710
  const model = new import_google_gauth.ChatGoogle({
714
711
  modelName: (options == null ? void 0 : options.model) ?? "gemini-1.5-pro",
715
712
  apiVersion: "v1beta"
716
713
  }).bindTools(tools);
717
- return model.stream(messages, {
718
- metadata: {
719
- conversation_id: threadId
720
- }
721
- });
714
+ return model.stream(messages);
722
715
  }
723
716
  });
724
717
  }