@copilotkit/runtime 1.3.16-mme-copilot-suggestions.1 → 1.3.16-mme-reset-chat.2

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 (42) hide show
  1. package/CHANGELOG.md +14 -6
  2. package/dist/{chunk-ZP2IRHF3.mjs → chunk-7LIN2NIO.mjs} +2 -2
  3. package/dist/{chunk-SKS2SK3W.mjs → chunk-AXHCROTL.mjs} +2 -2
  4. package/dist/{chunk-2H4XYEHG.mjs → chunk-DX45O7PM.mjs} +2 -2
  5. package/dist/chunk-DX45O7PM.mjs.map +1 -0
  6. package/dist/{chunk-SKKQQVDM.mjs → chunk-KFO5XSPV.mjs} +2 -2
  7. package/dist/{chunk-VGYN7TGZ.mjs → chunk-SMVZ2NQP.mjs} +29 -19
  8. package/dist/{chunk-VGYN7TGZ.mjs.map → chunk-SMVZ2NQP.mjs.map} +1 -1
  9. package/dist/{chunk-XBB3O4AV.mjs → chunk-STQIVH2M.mjs} +3 -3
  10. package/dist/{groq-adapter-2d3a332a.d.ts → groq-adapter-b122e71f.d.ts} +1 -3
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +29 -19
  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 +29 -19
  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 +28 -18
  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 +23 -19
  38. package/dist/chunk-2H4XYEHG.mjs.map +0 -1
  39. /package/dist/{chunk-ZP2IRHF3.mjs.map → chunk-7LIN2NIO.mjs.map} +0 -0
  40. /package/dist/{chunk-SKS2SK3W.mjs.map → chunk-AXHCROTL.mjs.map} +0 -0
  41. /package/dist/{chunk-SKKQQVDM.mjs.map → chunk-KFO5XSPV.mjs.map} +0 -0
  42. /package/dist/{chunk-XBB3O4AV.mjs.map → chunk-STQIVH2M.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-XBB3O4AV.mjs";
4
+ } from "./chunk-STQIVH2M.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-VGYN7TGZ.mjs";
14
+ } from "./chunk-SMVZ2NQP.mjs";
15
15
  import {
16
16
  config,
17
17
  copilotRuntimeNextJSAppRouterEndpoint,
18
18
  copilotRuntimeNextJSPagesRouterEndpoint
19
- } from "./chunk-ZP2IRHF3.mjs";
19
+ } from "./chunk-7LIN2NIO.mjs";
20
20
  import {
21
21
  copilotRuntimeNestEndpoint
22
- } from "./chunk-SKKQQVDM.mjs";
22
+ } from "./chunk-KFO5XSPV.mjs";
23
23
  import {
24
24
  copilotRuntimeNodeExpressEndpoint
25
- } from "./chunk-SKS2SK3W.mjs";
25
+ } from "./chunk-AXHCROTL.mjs";
26
26
  import {
27
27
  buildSchema,
28
28
  copilotRuntimeNodeHttpEndpoint,
29
29
  createContext,
30
30
  getCommonConfig
31
- } from "./chunk-2H4XYEHG.mjs";
31
+ } from "./chunk-DX45O7PM.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-2d3a332a.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';
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-copilot-suggestions.1",
47
+ version: "1.3.16-mme-reset-chat.2",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -668,6 +668,7 @@ __name(encodeResult, "encodeResult");
668
668
 
669
669
  // src/service-adapters/langchain/langchain-adapter.ts
670
670
  var import_shared3 = require("@copilotkit/shared");
671
+ var import_promises = require("@langchain/core/callbacks/promises");
671
672
  var LangChainAdapter = class {
672
673
  options;
673
674
  /**
@@ -677,23 +678,28 @@ var LangChainAdapter = class {
677
678
  this.options = options;
678
679
  }
679
680
  async process(request) {
680
- const { eventSource, model, actions, messages, threadId, runId } = request;
681
- const result = await this.options.chainFn({
682
- messages: messages.map(convertMessageToLangChainMessage),
683
- tools: actions.map(convertActionInputToLangChainTool),
684
- model,
685
- threadId,
686
- runId
687
- });
688
- eventSource.stream(async (eventStream$) => {
689
- await streamLangChainResponse({
690
- result,
691
- eventStream$
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
692
690
  });
693
- });
694
- return {
695
- threadId: threadId || (0, import_shared3.randomId)()
696
- };
691
+ eventSource.stream(async (eventStream$) => {
692
+ await streamLangChainResponse({
693
+ result,
694
+ eventStream$
695
+ });
696
+ });
697
+ return {
698
+ threadId
699
+ };
700
+ } finally {
701
+ await (0, import_promises.awaitAllCallbacks)();
702
+ }
697
703
  }
698
704
  };
699
705
  __name(LangChainAdapter, "LangChainAdapter");
@@ -703,12 +709,16 @@ var import_google_gauth = require("@langchain/google-gauth");
703
709
  var GoogleGenerativeAIAdapter = class extends LangChainAdapter {
704
710
  constructor(options) {
705
711
  super({
706
- chainFn: async ({ messages, tools }) => {
712
+ chainFn: async ({ messages, tools, threadId }) => {
707
713
  const model = new import_google_gauth.ChatGoogle({
708
714
  modelName: (options == null ? void 0 : options.model) ?? "gemini-1.5-pro",
709
715
  apiVersion: "v1beta"
710
716
  }).bindTools(tools);
711
- return model.stream(messages);
717
+ return model.stream(messages, {
718
+ metadata: {
719
+ conversation_id: threadId
720
+ }
721
+ });
712
722
  }
713
723
  });
714
724
  }