@copilotkit/runtime 1.50.0 → 1.50.1-next.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/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.50.0",
12
+ "version": "1.50.1-next.0",
13
13
  "sideEffects": false,
14
14
  "main": "./dist/index.js",
15
15
  "module": "./dist/index.mjs",
@@ -72,7 +72,7 @@
72
72
  "rxjs": "7.8.1",
73
73
  "type-graphql": "2.0.0-rc.1",
74
74
  "zod": "^3.23.3",
75
- "@copilotkit/shared": "1.50.0"
75
+ "@copilotkit/shared": "1.50.1-next.0"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@anthropic-ai/sdk": "^0.57.0",
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * const copilotKit = new CopilotRuntime();
13
13
  *
14
- * return new GoogleGenerativeAIAdapter({ model: "gemini-1.5-pro" });
14
+ * return new GoogleGenerativeAIAdapter({ model: "gemini-2.5-flash", apiVersion: "v1" });
15
15
  * ```
16
16
  */
17
17
  import { LangChainAdapter } from "../langchain/langchain-adapter";
@@ -21,19 +21,34 @@ interface GoogleGenerativeAIAdapterOptions {
21
21
  * A custom Google Generative AI model to use.
22
22
  */
23
23
  model?: string;
24
+ /**
25
+ * The API version to use (e.g. "v1" or "v1beta"). Defaults to "v1".
26
+ */
27
+ apiVersion?: "v1" | "v1beta";
24
28
  /**
25
29
  * The API key to use.
26
30
  */
27
31
  apiKey?: string;
28
32
  }
29
33
 
30
- const DEFAULT_MODEL = "gemini-1.5-pro";
34
+ const DEFAULT_MODEL = "gemini-2.5-flash";
35
+ const DEFAULT_API_VERSION: GoogleGenerativeAIAdapterOptions["apiVersion"] = "v1";
36
+ let hasWarnedDefaultGoogleModel = false;
31
37
 
32
38
  export class GoogleGenerativeAIAdapter extends LangChainAdapter {
33
39
  public provider = "google";
34
40
  public model: string = DEFAULT_MODEL;
35
41
 
36
42
  constructor(options?: GoogleGenerativeAIAdapterOptions) {
43
+ if (!hasWarnedDefaultGoogleModel && !options?.model && !options?.apiVersion) {
44
+ console.warn(
45
+ `You are using the GoogleGenerativeAIAdapter without explicitly setting a model or apiVersion. ` +
46
+ `CopilotKit will default to apiVersion="v1" and model="${DEFAULT_MODEL}". ` +
47
+ `To silence this warning, pass model and apiVersion when constructing the adapter.`,
48
+ );
49
+ hasWarnedDefaultGoogleModel = true;
50
+ }
51
+
37
52
  super({
38
53
  chainFn: async ({ messages, tools, threadId }) => {
39
54
  // Lazy require for optional peer dependencies
@@ -59,11 +74,11 @@ export class GoogleGenerativeAIAdapter extends LangChainAdapter {
59
74
  );
60
75
  });
61
76
 
62
- this.model = options?.model ?? "gemini-1.5-pro";
77
+ this.model = options?.model ?? DEFAULT_MODEL;
63
78
  const model = new ChatGoogle({
64
79
  apiKey: options?.apiKey ?? process.env.GOOGLE_API_KEY,
65
80
  modelName: this.model,
66
- apiVersion: "v1beta",
81
+ apiVersion: options?.apiVersion ?? DEFAULT_API_VERSION,
67
82
  }).bindTools(tools);
68
83
 
69
84
  return model.stream(filteredMessages, { metadata: { conversation_id: threadId } });