@livekit/agents-plugin-google 1.0.0-next.1 → 1.0.0-next.3

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.
@@ -4,6 +4,6 @@ var import_agents_plugins_test = require("@livekit/agents-plugins-test");
4
4
  var import_vitest = require("vitest");
5
5
  var import_gemini_tts = require("./gemini_tts.cjs");
6
6
  (0, import_vitest.describe)("Google Gemini TTS", async () => {
7
- await (0, import_agents_plugins_test.tts)(new import_gemini_tts.TTS(), new import_agents_plugin_openai.STT(), { nonStreaming: true, streaming: false });
7
+ await (0, import_agents_plugins_test.tts)(new import_gemini_tts.TTS(), new import_agents_plugin_openai.STT());
8
8
  });
9
9
  //# sourceMappingURL=gemini_tts.test.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/beta/gemini_tts.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { STT } from '@livekit/agents-plugin-openai';\nimport { tts } from '@livekit/agents-plugins-test';\nimport { describe } from 'vitest';\nimport { TTS } from './gemini_tts.js';\n\ndescribe('Google Gemini TTS', async () => {\n await tts(new TTS(), new STT(), { nonStreaming: true, streaming: false });\n});\n"],"mappings":";AAGA,kCAAoB;AACpB,iCAAoB;AACpB,oBAAyB;AACzB,wBAAoB;AAAA,IAEpB,wBAAS,qBAAqB,YAAY;AACxC,YAAM,gCAAI,IAAI,sBAAI,GAAG,IAAI,gCAAI,GAAG,EAAE,cAAc,MAAM,WAAW,MAAM,CAAC;AAC1E,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/beta/gemini_tts.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { STT } from '@livekit/agents-plugin-openai';\nimport { tts } from '@livekit/agents-plugins-test';\nimport { describe } from 'vitest';\nimport { TTS } from './gemini_tts.js';\n\ndescribe('Google Gemini TTS', async () => {\n await tts(new TTS(), new STT());\n});\n"],"mappings":";AAGA,kCAAoB;AACpB,iCAAoB;AACpB,oBAAyB;AACzB,wBAAoB;AAAA,IAEpB,wBAAS,qBAAqB,YAAY;AACxC,YAAM,gCAAI,IAAI,sBAAI,GAAG,IAAI,gCAAI,CAAC;AAChC,CAAC;","names":[]}
@@ -3,6 +3,6 @@ import { tts } from "@livekit/agents-plugins-test";
3
3
  import { describe } from "vitest";
4
4
  import { TTS } from "./gemini_tts.js";
5
5
  describe("Google Gemini TTS", async () => {
6
- await tts(new TTS(), new STT(), { nonStreaming: true, streaming: false });
6
+ await tts(new TTS(), new STT());
7
7
  });
8
8
  //# sourceMappingURL=gemini_tts.test.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/beta/gemini_tts.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { STT } from '@livekit/agents-plugin-openai';\nimport { tts } from '@livekit/agents-plugins-test';\nimport { describe } from 'vitest';\nimport { TTS } from './gemini_tts.js';\n\ndescribe('Google Gemini TTS', async () => {\n await tts(new TTS(), new STT(), { nonStreaming: true, streaming: false });\n});\n"],"mappings":"AAGA,SAAS,WAAW;AACpB,SAAS,WAAW;AACpB,SAAS,gBAAgB;AACzB,SAAS,WAAW;AAEpB,SAAS,qBAAqB,YAAY;AACxC,QAAM,IAAI,IAAI,IAAI,GAAG,IAAI,IAAI,GAAG,EAAE,cAAc,MAAM,WAAW,MAAM,CAAC;AAC1E,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/beta/gemini_tts.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { STT } from '@livekit/agents-plugin-openai';\nimport { tts } from '@livekit/agents-plugins-test';\nimport { describe } from 'vitest';\nimport { TTS } from './gemini_tts.js';\n\ndescribe('Google Gemini TTS', async () => {\n await tts(new TTS(), new STT());\n});\n"],"mappings":"AAGA,SAAS,WAAW;AACpB,SAAS,WAAW;AACpB,SAAS,gBAAgB;AACzB,SAAS,WAAW;AAEpB,SAAS,qBAAqB,YAAY;AACxC,QAAM,IAAI,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC;AAChC,CAAC;","names":[]}
package/dist/llm.test.cjs CHANGED
@@ -3,6 +3,11 @@ var import_agents_plugins_test = require("@livekit/agents-plugins-test");
3
3
  var import_vitest = require("vitest");
4
4
  var import_llm = require("./llm.cjs");
5
5
  (0, import_vitest.describe)("Google", async () => {
6
- await (0, import_agents_plugins_test.llm)(new import_llm.LLM());
6
+ await (0, import_agents_plugins_test.llm)(
7
+ new import_llm.LLM({
8
+ model: "gemini-2.5-flash",
9
+ temperature: 0
10
+ })
11
+ );
7
12
  });
8
13
  //# sourceMappingURL=llm.test.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/llm.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { llm } from '@livekit/agents-plugins-test';\nimport { describe } from 'vitest';\nimport { LLM } from './llm.js';\n\ndescribe('Google', async () => {\n await llm(new LLM());\n});\n"],"mappings":";AAGA,iCAAoB;AACpB,oBAAyB;AACzB,iBAAoB;AAAA,IAEpB,wBAAS,UAAU,YAAY;AAC7B,YAAM,gCAAI,IAAI,eAAI,CAAC;AACrB,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/llm.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { llm } from '@livekit/agents-plugins-test';\nimport { describe } from 'vitest';\nimport { LLM } from './llm.js';\n\ndescribe('Google', async () => {\n await llm(\n new LLM({\n model: 'gemini-2.5-flash',\n temperature: 0,\n }),\n );\n});\n"],"mappings":";AAGA,iCAAoB;AACpB,oBAAyB;AACzB,iBAAoB;AAAA,IAEpB,wBAAS,UAAU,YAAY;AAC7B,YAAM;AAAA,IACJ,IAAI,eAAI;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AACF,CAAC;","names":[]}
package/dist/llm.test.js CHANGED
@@ -2,6 +2,11 @@ import { llm } from "@livekit/agents-plugins-test";
2
2
  import { describe } from "vitest";
3
3
  import { LLM } from "./llm.js";
4
4
  describe("Google", async () => {
5
- await llm(new LLM());
5
+ await llm(
6
+ new LLM({
7
+ model: "gemini-2.5-flash",
8
+ temperature: 0
9
+ })
10
+ );
6
11
  });
7
12
  //# sourceMappingURL=llm.test.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/llm.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { llm } from '@livekit/agents-plugins-test';\nimport { describe } from 'vitest';\nimport { LLM } from './llm.js';\n\ndescribe('Google', async () => {\n await llm(new LLM());\n});\n"],"mappings":"AAGA,SAAS,WAAW;AACpB,SAAS,gBAAgB;AACzB,SAAS,WAAW;AAEpB,SAAS,UAAU,YAAY;AAC7B,QAAM,IAAI,IAAI,IAAI,CAAC;AACrB,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/llm.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2024 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { llm } from '@livekit/agents-plugins-test';\nimport { describe } from 'vitest';\nimport { LLM } from './llm.js';\n\ndescribe('Google', async () => {\n await llm(\n new LLM({\n model: 'gemini-2.5-flash',\n temperature: 0,\n }),\n );\n});\n"],"mappings":"AAGA,SAAS,WAAW;AACpB,SAAS,gBAAgB;AACzB,SAAS,WAAW;AAEpB,SAAS,UAAU,YAAY;AAC7B,QAAM;AAAA,IACJ,IAAI,IAAI;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AACF,CAAC;","names":[]}
package/dist/utils.cjs CHANGED
@@ -119,7 +119,7 @@ function toFunctionDeclarations(toolCtx) {
119
119
  const functionDeclarations = [];
120
120
  for (const [name, tool] of Object.entries(toolCtx)) {
121
121
  const { description, parameters } = tool;
122
- const jsonSchema = import_agents.llm.toJsonSchema(parameters);
122
+ const jsonSchema = import_agents.llm.toJsonSchema(parameters, false);
123
123
  const schemaCopy = JSON.parse(JSON.stringify(jsonSchema));
124
124
  functionDeclarations.push({
125
125
  name,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { FunctionDeclaration, Schema } from '@google/genai';\nimport { llm } from '@livekit/agents';\nimport type { JSONSchema7 } from 'json-schema';\n\n/**\n * JSON Schema v7\n * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01\n */\nexport type JSONSchema7Definition = JSONSchema7 | boolean;\n\n/**\n * Converts JSON Schema 7 to OpenAPI Schema 3.0\n */\n// Adapted from https://github.com/vercel/ai/blob/main/packages/google/src/convert-json-schema-to-openapi-schema.ts\nexport function convertJSONSchemaToOpenAPISchema(jsonSchema: JSONSchema7Definition): unknown {\n // parameters need to be undefined if they are empty objects:\n if (jsonSchema == null || isEmptyObjectSchema(jsonSchema)) {\n return undefined;\n }\n\n if (typeof jsonSchema === 'boolean') {\n return { type: 'boolean', properties: {} };\n }\n\n const {\n type,\n description,\n required,\n properties,\n items,\n allOf,\n anyOf,\n oneOf,\n format,\n const: constValue,\n minLength,\n enum: enumValues,\n } = jsonSchema;\n\n const result: Record<string, unknown> = {};\n\n if (description) result.description = description;\n if (required) result.required = required;\n if (format) result.format = format;\n\n if (constValue !== undefined) {\n result.enum = [constValue];\n }\n\n // Handle type\n if (type) {\n if (Array.isArray(type)) {\n if (type.includes('null')) {\n result.type = type.filter((t) => t !== 'null')[0];\n result.nullable = true;\n } else {\n result.type = type;\n }\n } else if (type === 'null') {\n result.type = 'null';\n } else {\n result.type = type;\n }\n }\n\n // Handle enum\n if (enumValues !== undefined) {\n result.enum = enumValues;\n }\n\n if (properties != null) {\n result.properties = Object.entries(properties).reduce(\n (acc, [key, value]) => {\n acc[key] = convertJSONSchemaToOpenAPISchema(value);\n return acc;\n },\n {} as Record<string, unknown>,\n );\n }\n\n if (items) {\n result.items = Array.isArray(items)\n ? items.map(convertJSONSchemaToOpenAPISchema)\n : convertJSONSchemaToOpenAPISchema(items);\n }\n\n if (allOf) {\n result.allOf = allOf.map(convertJSONSchemaToOpenAPISchema);\n }\n if (anyOf) {\n // Handle cases where anyOf includes a null type\n if (anyOf.some((schema) => typeof schema === 'object' && schema?.type === 'null')) {\n const nonNullSchemas = anyOf.filter(\n (schema) => !(typeof schema === 'object' && schema?.type === 'null'),\n );\n\n if (nonNullSchemas.length === 1) {\n // If there's only one non-null schema, convert it and make it nullable\n const converted = convertJSONSchemaToOpenAPISchema(\n nonNullSchemas[0] as JSONSchema7Definition,\n );\n if (typeof converted === 'object') {\n result.nullable = true;\n Object.assign(result, converted);\n }\n } else {\n // If there are multiple non-null schemas, keep them in anyOf\n result.anyOf = nonNullSchemas.map(convertJSONSchemaToOpenAPISchema);\n result.nullable = true;\n }\n } else {\n result.anyOf = anyOf.map(convertJSONSchemaToOpenAPISchema);\n }\n }\n if (oneOf) {\n result.oneOf = oneOf.map(convertJSONSchemaToOpenAPISchema);\n }\n\n if (minLength !== undefined) {\n result.minLength = minLength;\n }\n\n return result;\n}\n\nfunction isEmptyObjectSchema(jsonSchema: JSONSchema7Definition): boolean {\n return (\n jsonSchema != null &&\n typeof jsonSchema === 'object' &&\n jsonSchema.type === 'object' &&\n (jsonSchema.properties == null || Object.keys(jsonSchema.properties).length === 0) &&\n !jsonSchema.additionalProperties\n );\n}\n\nexport function toFunctionDeclarations(toolCtx: llm.ToolContext): FunctionDeclaration[] {\n const functionDeclarations: FunctionDeclaration[] = [];\n\n for (const [name, tool] of Object.entries(toolCtx)) {\n const { description, parameters } = tool;\n const jsonSchema = llm.toJsonSchema(parameters);\n\n // Create a deep copy to prevent the Google GenAI library from mutating the schema\n const schemaCopy = JSON.parse(JSON.stringify(jsonSchema));\n\n functionDeclarations.push({\n name,\n description,\n parameters: convertJSONSchemaToOpenAPISchema(schemaCopy) as Schema,\n });\n }\n\n return functionDeclarations;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oBAAoB;AAab,SAAS,iCAAiC,YAA4C;AAE3F,MAAI,cAAc,QAAQ,oBAAoB,UAAU,GAAG;AACzD,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,eAAe,WAAW;AACnC,WAAO,EAAE,MAAM,WAAW,YAAY,CAAC,EAAE;AAAA,EAC3C;AAEA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,MAAM;AAAA,EACR,IAAI;AAEJ,QAAM,SAAkC,CAAC;AAEzC,MAAI,YAAa,QAAO,cAAc;AACtC,MAAI,SAAU,QAAO,WAAW;AAChC,MAAI,OAAQ,QAAO,SAAS;AAE5B,MAAI,eAAe,QAAW;AAC5B,WAAO,OAAO,CAAC,UAAU;AAAA,EAC3B;AAGA,MAAI,MAAM;AACR,QAAI,MAAM,QAAQ,IAAI,GAAG;AACvB,UAAI,KAAK,SAAS,MAAM,GAAG;AACzB,eAAO,OAAO,KAAK,OAAO,CAAC,MAAM,MAAM,MAAM,EAAE,CAAC;AAChD,eAAO,WAAW;AAAA,MACpB,OAAO;AACL,eAAO,OAAO;AAAA,MAChB;AAAA,IACF,WAAW,SAAS,QAAQ;AAC1B,aAAO,OAAO;AAAA,IAChB,OAAO;AACL,aAAO,OAAO;AAAA,IAChB;AAAA,EACF;AAGA,MAAI,eAAe,QAAW;AAC5B,WAAO,OAAO;AAAA,EA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,MAChF,CAAC,WAAW;AAEhB;AAEO,SAAS,uBAAuB,SAAiD;AACtF,QAAM,uBAA8C,CAAC;AAErD,aAAW,CAAC,MAAM,IAAI,KAAK,OAAO,QAAQ,OAAO,GAAG;AAClD,UAAM,EAAE,aAAa,WAAW,IAAI;AACpC,UAAM,aAAa,kBAAI,aAAa,UAAU;AAG9C,UAAM,aAAa,KAAK,MAAM,KAAK,UAAU,UAAU,CAAC;AAExD,yBAAqB,KAAK;AAAA,MACxB;AAAA,MACA;AAAA,MACA,YAAY,iCAAiC,UAAU;AAAA,IACzD,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { FunctionDeclaration, Schema } from '@google/genai';\nimport { llm } from '@livekit/agents';\nimport type { JSONSchema7 } from 'json-schema';\n\n/**\n * JSON Schema v7\n * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01\n */\nexport type JSONSchema7Definition = JSONSchema7 | boolean;\n\n/**\n * Converts JSON Schema 7 to OpenAPI Schema 3.0\n */\n// Adapted from https://github.com/vercel/ai/blob/main/packages/google/src/convert-json-schema-to-openapi-schema.ts\nexport function convertJSONSchemaToOpenAPISchema(jsonSchema: JSONSchema7Definition): unknown {\n // parameters need to be undefined if they are empty objects:\n if (jsonSchema == null || isEmptyObjectSchema(jsonSchema)) {\n return undefined;\n }\n\n if (typeof jsonSchema === 'boolean') {\n return { type: 'boolean', properties: {} };\n }\n\n const {\n type,\n description,\n required,\n properties,\n items,\n allOf,\n anyOf,\n oneOf,\n format,\n const: constValue,\n minLength,\n enum: enumValues,\n } = jsonSchema;\n\n const result: Record<string, unknown> = {};\n\n if (description) result.description = description;\n if (required) result.required = required;\n if (format) result.format = format;\n\n if (constValue !== undefined) {\n result.enum = [constValue];\n }\n\n // Handle type\n if (type) {\n if (Array.isArray(type)) {\n if (type.includes('null')) {\n result.type = type.filter((t) => t !== 'null')[0];\n result.nullable = true;\n } else {\n result.type = type;\n }\n } else if (type === 'null') {\n result.type = 'null';\n } else {\n result.type = type;\n }\n }\n\n // Handle enum\n if (enumValues !== undefined) {\n result.enum = enumValues;\n }\n\n if (properties != null) {\n result.properties = Object.entries(properties).reduce(\n (acc, [key, value]) => {\n acc[key] = convertJSONSchemaToOpenAPISchema(value);\n return acc;\n },\n {} as Record<string, unknown>,\n );\n }\n\n if (items) {\n result.items = Array.isArray(items)\n ? items.map(convertJSONSchemaToOpenAPISchema)\n : convertJSONSchemaToOpenAPISchema(items);\n }\n\n if (allOf) {\n result.allOf = allOf.map(convertJSONSchemaToOpenAPISchema);\n }\n if (anyOf) {\n // Handle cases where anyOf includes a null type\n if (anyOf.some((schema) => typeof schema === 'object' && schema?.type === 'null')) {\n const nonNullSchemas = anyOf.filter(\n (schema) => !(typeof schema === 'object' && schema?.type === 'null'),\n );\n\n if (nonNullSchemas.length === 1) {\n // If there's only one non-null schema, convert it and make it nullable\n const converted = convertJSONSchemaToOpenAPISchema(\n nonNullSchemas[0] as JSONSchema7Definition,\n );\n if (typeof converted === 'object') {\n result.nullable = true;\n Object.assign(result, converted);\n }\n } else {\n // If there are multiple non-null schemas, keep them in anyOf\n result.anyOf = nonNullSchemas.map(convertJSONSchemaToOpenAPISchema);\n result.nullable = true;\n }\n } else {\n result.anyOf = anyOf.map(convertJSONSchemaToOpenAPISchema);\n }\n }\n if (oneOf) {\n result.oneOf = oneOf.map(convertJSONSchemaToOpenAPISchema);\n }\n\n if (minLength !== undefined) {\n result.minLength = minLength;\n }\n\n return result;\n}\n\nfunction isEmptyObjectSchema(jsonSchema: JSONSchema7Definition): boolean {\n return (\n jsonSchema != null &&\n typeof jsonSchema === 'object' &&\n jsonSchema.type === 'object' &&\n (jsonSchema.properties == null || Object.keys(jsonSchema.properties).length === 0) &&\n !jsonSchema.additionalProperties\n );\n}\n\nexport function toFunctionDeclarations(toolCtx: llm.ToolContext): FunctionDeclaration[] {\n const functionDeclarations: FunctionDeclaration[] = [];\n\n for (const [name, tool] of Object.entries(toolCtx)) {\n const { description, parameters } = tool;\n const jsonSchema = llm.toJsonSchema(parameters, false);\n\n // Create a deep copy to prevent the Google GenAI library from mutating the schema\n const schemaCopy = JSON.parse(JSON.stringify(jsonSchema));\n\n functionDeclarations.push({\n name,\n description,\n parameters: convertJSONSchemaToOpenAPISchema(schemaCopy) as Schema,\n });\n }\n\n return functionDeclarations;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oBAAoB;AAab,SAAS,iCAAiC,YAA4C;AAE3F,MAAI,cAAc,QAAQ,oBAAoB,UAAU,GAAG;AACzD,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,eAAe,WAAW;AACnC,WAAO,EAAE,MAAM,WAAW,YAAY,CAAC,EAAE;AAAA,EAC3C;AAEA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,MAAM;AAAA,EACR,IAAI;AAEJ,QAAM,SAAkC,CAAC;AAEzC,MAAI,YAAa,QAAO,cAAc;AACtC,MAAI,SAAU,QAAO,WAAW;AAChC,MAAI,OAAQ,QAAO,SAAS;AAE5B,MAAI,eAAe,QAAW;AAC5B,WAAO,OAAO,CAAC,UAAU;AAAA,EAC3B;AAGA,MAAI,MAAM;AACR,QAAI,MAAM,QAAQ,IAAI,GAAG;AACvB,UAAI,KAAK,SAAS,MAAM,GAAG;AACzB,eAAO,OAAO,KAAK,OAAO,CAAC,MAAM,MAAM,MAAM,EAAE,CAAC;AAChD,eAAO,WAAW;AAAA,MACpB,OAAO;AACL,eAAO,OAAO;AAAA,MAChB;AAAA,IACF,WAAW,SAAS,QAAQ;AAC1B,aAAO,OAAO;AAAA,IAChB,OAAO;AAC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AAO,eAAe,YACtB,WAAW,SAAS,aACnB,WAAW,cAAc,QAAQ,OAAO,KAAK,WAAW,UAAU,EAAE,WAAW,MAChF,CAAC,WAAW;AAEhB;AAEO,SAAS,uBAAuB,SAAiD;AACtF,QAAM,uBAA8C,CAAC;AAErD,aAAW,CAAC,MAAM,IAAI,KAAK,OAAO,QAAQ,OAAO,GAAG;AAClD,UAAM,EAAE,aAAa,WAAW,IAAI;AACpC,UAAM,aAAa,kBAAI,aAAa,YAAY,KAAK;AAGrD,UAAM,aAAa,KAAK,MAAM,KAAK,UAAU,UAAU,CAAC;AAExD,yBAAqB,KAAK;AAAA,MACxB;AAAA,MACA;AAAA,MACA,YAAY,iCAAiC,UAAU;AAAA,IACzD,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
package/dist/utils.js CHANGED
@@ -95,7 +95,7 @@ function toFunctionDeclarations(toolCtx) {
95
95
  const functionDeclarations = [];
96
96
  for (const [name, tool] of Object.entries(toolCtx)) {
97
97
  const { description, parameters } = tool;
98
- const jsonSchema = llm.toJsonSchema(parameters);
98
+ const jsonSchema = llm.toJsonSchema(parameters, false);
99
99
  const schemaCopy = JSON.parse(JSON.stringify(jsonSchema));
100
100
  functionDeclarations.push({
101
101
  name,
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { FunctionDeclaration, Schema } from '@google/genai';\nimport { llm } from '@livekit/agents';\nimport type { JSONSchema7 } from 'json-schema';\n\n/**\n * JSON Schema v7\n * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01\n */\nexport type JSONSchema7Definition = JSONSchema7 | boolean;\n\n/**\n * Converts JSON Schema 7 to OpenAPI Schema 3.0\n */\n// Adapted from https://github.com/vercel/ai/blob/main/packages/google/src/convert-json-schema-to-openapi-schema.ts\nexport function convertJSONSchemaToOpenAPISchema(jsonSchema: JSONSchema7Definition): unknown {\n // parameters need to be undefined if they are empty objects:\n if (jsonSchema == null || isEmptyObjectSchema(jsonSchema)) {\n return undefined;\n }\n\n if (typeof jsonSchema === 'boolean') {\n return { type: 'boolean', properties: {} };\n }\n\n const {\n type,\n description,\n required,\n properties,\n items,\n allOf,\n anyOf,\n oneOf,\n format,\n const: constValue,\n minLength,\n enum: enumValues,\n } = jsonSchema;\n\n const result: Record<string, unknown> = {};\n\n if (description) result.description = description;\n if (required) result.required = required;\n if (format) result.format = format;\n\n if (constValue !== undefined) {\n result.enum = [constValue];\n }\n\n // Handle type\n if (type) {\n if (Array.isArray(type)) {\n if (type.includes('null')) {\n result.type = type.filter((t) => t !== 'null')[0];\n result.nullable = true;\n } else {\n result.type = type;\n }\n } else if (type === 'null') {\n result.type = 'null';\n } else {\n result.type = type;\n }\n }\n\n // Handle enum\n if (enumValues !== undefined) {\n result.enum = enumValues;\n }\n\n if (properties != null) {\n result.properties = Object.entries(properties).reduce(\n (acc, [key, value]) => {\n acc[key] = convertJSONSchemaToOpenAPISchema(value);\n return acc;\n },\n {} as Record<string, unknown>,\n );\n }\n\n if (items) {\n result.items = Array.isArray(items)\n ? items.map(convertJSONSchemaToOpenAPISchema)\n : convertJSONSchemaToOpenAPISchema(items);\n }\n\n if (allOf) {\n result.allOf = allOf.map(convertJSONSchemaToOpenAPISchema);\n }\n if (anyOf) {\n // Handle cases where anyOf includes a null type\n if (anyOf.some((schema) => typeof schema === 'object' && schema?.type === 'null')) {\n const nonNullSchemas = anyOf.filter(\n (schema) => !(typeof schema === 'object' && schema?.type === 'null'),\n );\n\n if (nonNullSchemas.length === 1) {\n // If there's only one non-null schema, convert it and make it nullable\n const converted = convertJSONSchemaToOpenAPISchema(\n nonNullSchemas[0] as JSONSchema7Definition,\n );\n if (typeof converted === 'object') {\n result.nullable = true;\n Object.assign(result, converted);\n }\n } else {\n // If there are multiple non-null schemas, keep them in anyOf\n result.anyOf = nonNullSchemas.map(convertJSONSchemaToOpenAPISchema);\n result.nullable = true;\n }\n } else {\n result.anyOf = anyOf.map(convertJSONSchemaToOpenAPISchema);\n }\n }\n if (oneOf) {\n result.oneOf = oneOf.map(convertJSONSchemaToOpenAPISchema);\n }\n\n if (minLength !== undefined) {\n result.minLength = minLength;\n }\n\n return result;\n}\n\nfunction isEmptyObjectSchema(jsonSchema: JSONSchema7Definition): boolean {\n return (\n jsonSchema != null &&\n typeof jsonSchema === 'object' &&\n jsonSchema.type === 'object' &&\n (jsonSchema.properties == null || Object.keys(jsonSchema.properties).length === 0) &&\n !jsonSchema.additionalProperties\n );\n}\n\nexport function toFunctionDeclarations(toolCtx: llm.ToolContext): FunctionDeclaration[] {\n const functionDeclarations: FunctionDeclaration[] = [];\n\n for (const [name, tool] of Object.entries(toolCtx)) {\n const { description, parameters } = tool;\n const jsonSchema = llm.toJsonSchema(parameters);\n\n // Create a deep copy to prevent the Google GenAI library from mutating the schema\n const schemaCopy = JSON.parse(JSON.stringify(jsonSchema));\n\n functionDeclarations.push({\n name,\n description,\n parameters: convertJSONSchemaToOpenAPISchema(schemaCopy) as Schema,\n });\n }\n\n return functionDeclarations;\n}\n"],"mappings":"AAIA,SAAS,WAAW;AAab,SAAS,iCAAiC,YAA4C;AAE3F,MAAI,cAAc,QAAQ,oBAAoB,UAAU,GAAG;AACzD,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,eAAe,WAAW;AACnC,WAAO,EAAE,MAAM,WAAW,YAAY,CAAC,EAAE;AAAA,EAC3C;AAEA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,MAAM;AAAA,EACR,IAAI;AAEJ,QAAM,SAAkC,CAAC;AAEzC,MAAI,YAAa,QAAO,cAAc;AACtC,MAAI,SAAU,QAAO,WAAW;AAChC,MAAI,OAAQ,QAAO,SAAS;AAE5B,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A,MACF,OAAO;AAEL,eAAO,QAAQ,eAAe,IAAI,gCAAgC;AAClE,eAAO,WAAW;AAAA,MACpB;AAAA,IACF,OAAO;AACL,aAAO,QAAQ,MAAM,IAAI,gCAAgC;AAAA,IAC3D;AAAA,EACF;AACA,MAAI,OAAO;AACT,WAAO,QAAQ,MAAM,IAAI,gCAAgC;AAAA,EAC3D;AAEA,MAAI,cAAc,QAAW;AAC3B,WAAO,YAAY;AAAA,EACrB;AAEA,SAAO;AACT;AAEA,SAAS,oBAAoB,YAA4C;AACvE,SACE,cAAc,QACd,OAAO,eAAe,YACtB,WAAW,SAAS,aACnB,WAAW,cAAc,QAAQ,OAAO,KAAK,WAAW,UAAU,EAAE,WAAW,MAChF,CAAC,WAAW;AAEhB;AAEO,SAAS,uBAAuB,SAAiD;AACtF,QAAM,uBAA8C,CAAC;AAErD,aAAW,CAAC,MAAM,IAAI,KAAK,OAAO,QAAQ,OAAO,GAAG;AAClD,UAAM,EAAE,aAAa,WAAW,IAAI;AACpC,UAAM,aAAa,IAAI,aAAa,UAAU;AAG9C,UAAM,aAAa,KAAK,MAAM,KAAK,UAAU,UAAU,CAAC;AAExD,yBAAqB,KAAK;AAAA,MACxB;AAAA,MACA;AAAA,MACA,YAAY,iCAAiC,UAAU;AAAA,IACzD,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { FunctionDeclaration, Schema } from '@google/genai';\nimport { llm } from '@livekit/agents';\nimport type { JSONSchema7 } from 'json-schema';\n\n/**\n * JSON Schema v7\n * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01\n */\nexport type JSONSchema7Definition = JSONSchema7 | boolean;\n\n/**\n * Converts JSON Schema 7 to OpenAPI Schema 3.0\n */\n// Adapted from https://github.com/vercel/ai/blob/main/packages/google/src/convert-json-schema-to-openapi-schema.ts\nexport function convertJSONSchemaToOpenAPISchema(jsonSchema: JSONSchema7Definition): unknown {\n // parameters need to be undefined if they are empty objects:\n if (jsonSchema == null || isEmptyObjectSchema(jsonSchema)) {\n return undefined;\n }\n\n if (typeof jsonSchema === 'boolean') {\n return { type: 'boolean', properties: {} };\n }\n\n const {\n type,\n description,\n required,\n properties,\n items,\n allOf,\n anyOf,\n oneOf,\n format,\n const: constValue,\n minLength,\n enum: enumValues,\n } = jsonSchema;\n\n const result: Record<string, unknown> = {};\n\n if (description) result.description = description;\n if (required) result.required = required;\n if (format) result.format = format;\n\n if (constValue !== undefined) {\n result.enum = [constValue];\n }\n\n // Handle type\n if (type) {\n if (Array.isArray(type)) {\n if (type.includes('null')) {\n result.type = type.filter((t) => t !== 'null')[0];\n result.nullable = true;\n } else {\n result.type = type;\n }\n } else if (type === 'null') {\n result.type = 'null';\n } else {\n result.type = type;\n }\n }\n\n // Handle enum\n if (enumValues !== undefined) {\n result.enum = enumValues;\n }\n\n if (properties != null) {\n result.properties = Object.entries(properties).reduce(\n (acc, [key, value]) => {\n acc[key] = convertJSONSchemaToOpenAPISchema(value);\n return acc;\n },\n {} as Record<string, unknown>,\n );\n }\n\n if (items) {\n result.items = Array.isArray(items)\n ? items.map(convertJSONSchemaToOpenAPISchema)\n : convertJSONSchemaToOpenAPISchema(items);\n }\n\n if (allOf) {\n result.allOf = allOf.map(convertJSONSchemaToOpenAPISchema);\n }\n if (anyOf) {\n // Handle cases where anyOf includes a null type\n if (anyOf.some((schema) => typeof schema === 'object' && schema?.type === 'null')) {\n const nonNullSchemas = anyOf.filter(\n (schema) => !(typeof schema === 'object' && schema?.type === 'null'),\n );\n\n if (nonNullSchemas.length === 1) {\n // If there's only one non-null schema, convert it and make it nullable\n const converted = convertJSONSchemaToOpenAPISchema(\n nonNullSchemas[0] as JSONSchema7Definition,\n );\n if (typeof converted === 'object') {\n result.nullable = true;\n Object.assign(result, converted);\n }\n } else {\n // If there are multiple non-null schemas, keep them in anyOf\n result.anyOf = nonNullSchemas.map(convertJSONSchemaToOpenAPISchema);\n result.nullable = true;\n }\n } else {\n result.anyOf = anyOf.map(convertJSONSchemaToOpenAPISchema);\n }\n }\n if (oneOf) {\n result.oneOf = oneOf.map(convertJSONSchemaToOpenAPISchema);\n }\n\n if (minLength !== undefined) {\n result.minLength = minLength;\n }\n\n return result;\n}\n\nfunction isEmptyObjectSchema(jsonSchema: JSONSchema7Definition): boolean {\n return (\n jsonSchema != null &&\n typeof jsonSchema === 'object' &&\n jsonSchema.type === 'object' &&\n (jsonSchema.properties == null || Object.keys(jsonSchema.properties).length === 0) &&\n !jsonSchema.additionalProperties\n );\n}\n\nexport function toFunctionDeclarations(toolCtx: llm.ToolContext): FunctionDeclaration[] {\n const functionDeclarations: FunctionDeclaration[] = [];\n\n for (const [name, tool] of Object.entries(toolCtx)) {\n const { description, parameters } = tool;\n const jsonSchema = llm.toJsonSchema(parameters, false);\n\n // Create a deep copy to prevent the Google GenAI library from mutating the schema\n const schemaCopy = JSON.parse(JSON.stringify(jsonSchema));\n\n functionDeclarations.push({\n name,\n description,\n parameters: convertJSONSchemaToOpenAPISchema(schemaCopy) as Schema,\n });\n }\n\n return functionDeclarations;\n}\n"],"mappings":"AAIA,SAAS,WAAW;AAab,SAAS,iCAAiC,YAA4C;AAE3F,MAAI,cAAc,QAAQ,oBAAoB,UAAU,GAAG;AACzD,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,eAAe,WAAW;AACnC,WAAO,EAAE,MAAM,WAAW,YAAY,CAAC,EAAE;AAAA,EAC3C;AAEA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,MAAM;AAAA,EACR,IAAI;AAEJ,QAAM,SAAkC,CAAC;AAEzC,MAAI,YAAa,QAAO,cAAc;AACtC,MAAI,SAAU,QAAO,WAAW;AACh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OAAO,QAAQ,SAAS;AAAA,QACjC;AAAA,MACF,OAAO;AAEL,eAAO,QAAQ,eAAe,IAAI,gCAAgC;AAClE,eAAO,WAAW;AAAA,MACpB;AAAA,IACF,OAAO;AACL,aAAO,QAAQ,MAAM,IAAI,gCAAgC;AAAA,IAC3D;AAAA,EACF;AACA,MAAI,OAAO;AACT,WAAO,QAAQ,MAAM,IAAI,gCAAgC;AAAA,EAC3D;AAEA,MAAI,cAAc,QAAW;AAC3B,WAAO,YAAY;AAAA,EACrB;AAEA,SAAO;AACT;AAEA,SAAS,oBAAoB,YAA4C;AACvE,SACE,cAAc,QACd,OAAO,eAAe,YACtB,WAAW,SAAS,aACnB,WAAW,cAAc,QAAQ,OAAO,KAAK,WAAW,UAAU,EAAE,WAAW,MAChF,CAAC,WAAW;AAEhB;AAEO,SAAS,uBAAuB,SAAiD;AACtF,QAAM,uBAA8C,CAAC;AAErD,aAAW,CAAC,MAAM,IAAI,KAAK,OAAO,QAAQ,OAAO,GAAG;AAClD,UAAM,EAAE,aAAa,WAAW,IAAI;AACpC,UAAM,aAAa,IAAI,aAAa,YAAY,KAAK;AAGrD,UAAM,aAAa,KAAK,MAAM,KAAK,UAAU,UAAU,CAAC;AAExD,yBAAqB,KAAK;AAAA,MACxB;AAAA,MACA;AAAA,MACA,YAAY,iCAAiC,UAAU;AAAA,IACzD,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livekit/agents-plugin-google",
3
- "version": "1.0.0-next.1",
3
+ "version": "1.0.0-next.3",
4
4
  "description": "Google Gemini plugin for LiveKit Node Agents",
5
5
  "main": "dist/index.js",
6
6
  "require": "dist/index.cjs",
@@ -25,13 +25,13 @@
25
25
  "README.md"
26
26
  ],
27
27
  "devDependencies": {
28
- "@livekit/agents": "^1.0.0-next.1",
29
- "@livekit/agents-plugin-openai": "^1.0.0-next.1",
30
- "@livekit/agents-plugins-test": "^1.0.0-next.1",
31
28
  "@livekit/rtc-node": "^0.13.12",
32
29
  "@microsoft/api-extractor": "^7.35.0",
33
30
  "tsup": "^8.3.5",
34
- "typescript": "^5.0.0"
31
+ "typescript": "^5.0.0",
32
+ "@livekit/agents": "1.0.0-next.3",
33
+ "@livekit/agents-plugin-openai": "1.0.0-next.3",
34
+ "@livekit/agents-plugins-test": "1.0.0-next.3"
35
35
  },
36
36
  "dependencies": {
37
37
  "@google/genai": "^1.13.0",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@livekit/rtc-node": "^0.13.12",
44
- "@livekit/agents": "^1.0.0-next.11.0.0-next.1"
44
+ "@livekit/agents": "1.0.0-next.3"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsup --onSuccess \"pnpm build:types\"",
@@ -7,5 +7,5 @@ import { describe } from 'vitest';
7
7
  import { TTS } from './gemini_tts.js';
8
8
 
9
9
  describe('Google Gemini TTS', async () => {
10
- await tts(new TTS(), new STT(), { nonStreaming: true, streaming: false });
10
+ await tts(new TTS(), new STT());
11
11
  });
package/src/llm.test.ts CHANGED
@@ -6,5 +6,10 @@ import { describe } from 'vitest';
6
6
  import { LLM } from './llm.js';
7
7
 
8
8
  describe('Google', async () => {
9
- await llm(new LLM());
9
+ await llm(
10
+ new LLM({
11
+ model: 'gemini-2.5-flash',
12
+ temperature: 0,
13
+ }),
14
+ );
10
15
  });
package/src/utils.ts CHANGED
@@ -141,7 +141,7 @@ export function toFunctionDeclarations(toolCtx: llm.ToolContext): FunctionDeclar
141
141
 
142
142
  for (const [name, tool] of Object.entries(toolCtx)) {
143
143
  const { description, parameters } = tool;
144
- const jsonSchema = llm.toJsonSchema(parameters);
144
+ const jsonSchema = llm.toJsonSchema(parameters, false);
145
145
 
146
146
  // Create a deep copy to prevent the Google GenAI library from mutating the schema
147
147
  const schemaCopy = JSON.parse(JSON.stringify(jsonSchema));