beeai-framework 0.1.25 → 0.1.26
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/dist/adapters/a2a/agents/agent.d.cts +2 -2
- package/dist/adapters/a2a/agents/agent.d.ts +2 -2
- package/dist/adapters/a2a/agents/events.d.cts +1 -1
- package/dist/adapters/a2a/agents/events.d.ts +1 -1
- package/dist/adapters/a2a/agents/types.d.cts +2 -2
- package/dist/adapters/a2a/agents/types.d.ts +2 -2
- package/dist/adapters/a2a/serve/agent_executor.d.cts +3 -3
- package/dist/adapters/a2a/serve/agent_executor.d.ts +3 -3
- package/dist/adapters/a2a/serve/server.d.cts +2 -2
- package/dist/adapters/a2a/serve/server.d.ts +2 -2
- package/dist/adapters/acp/agents/agent.d.cts +2 -2
- package/dist/adapters/acp/agents/agent.d.ts +2 -2
- package/dist/adapters/acp/agents/events.d.cts +1 -1
- package/dist/adapters/acp/agents/events.d.ts +1 -1
- package/dist/adapters/agentstack/agents/agent.d.cts +2 -2
- package/dist/adapters/agentstack/agents/agent.d.ts +2 -2
- package/dist/adapters/agentstack/agents/events.d.cts +1 -1
- package/dist/adapters/agentstack/agents/events.d.ts +1 -1
- package/dist/adapters/amazon-bedrock/backend/chat.d.cts +2 -2
- package/dist/adapters/amazon-bedrock/backend/chat.d.ts +2 -2
- package/dist/adapters/amazon-bedrock/backend/embedding.d.cts +2 -2
- package/dist/adapters/amazon-bedrock/backend/embedding.d.ts +2 -2
- package/dist/adapters/anthropic/backend/chat.d.cts +2 -2
- package/dist/adapters/anthropic/backend/chat.d.ts +2 -2
- package/dist/adapters/anthropic/backend/embedding.d.cts +2 -2
- package/dist/adapters/anthropic/backend/embedding.d.ts +2 -2
- package/dist/adapters/azure-openai/backend/chat.d.cts +2 -2
- package/dist/adapters/azure-openai/backend/chat.d.ts +2 -2
- package/dist/adapters/azure-openai/backend/embedding.d.cts +2 -2
- package/dist/adapters/azure-openai/backend/embedding.d.ts +2 -2
- package/dist/adapters/dummy/backend/chat.d.cts +2 -2
- package/dist/adapters/dummy/backend/chat.d.ts +2 -2
- package/dist/adapters/dummy/backend/embedding.d.cts +2 -2
- package/dist/adapters/dummy/backend/embedding.d.ts +2 -2
- package/dist/adapters/google-vertex/backend/chat.d.cts +3 -3
- package/dist/adapters/google-vertex/backend/chat.d.ts +3 -3
- package/dist/adapters/google-vertex/backend/embedding.d.cts +2 -2
- package/dist/adapters/google-vertex/backend/embedding.d.ts +2 -2
- package/dist/adapters/groq/backend/chat.d.cts +2 -2
- package/dist/adapters/groq/backend/chat.d.ts +2 -2
- package/dist/adapters/groq/backend/embedding.d.cts +2 -2
- package/dist/adapters/groq/backend/embedding.d.ts +2 -2
- package/dist/adapters/langchain/backend/chat.d.cts +2 -2
- package/dist/adapters/langchain/backend/chat.d.ts +2 -2
- package/dist/adapters/langchain/backend/embedding.d.cts +2 -2
- package/dist/adapters/langchain/backend/embedding.d.ts +2 -2
- package/dist/adapters/langchain/tools.d.cts +1 -1
- package/dist/adapters/langchain/tools.d.ts +1 -1
- package/dist/adapters/ollama/backend/chat.d.cts +2 -2
- package/dist/adapters/ollama/backend/chat.d.ts +2 -2
- package/dist/adapters/ollama/backend/embedding.d.cts +2 -2
- package/dist/adapters/ollama/backend/embedding.d.ts +2 -2
- package/dist/adapters/openai/backend/chat.d.cts +2 -2
- package/dist/adapters/openai/backend/chat.d.ts +2 -2
- package/dist/adapters/openai/backend/embedding.d.cts +2 -2
- package/dist/adapters/openai/backend/embedding.d.ts +2 -2
- package/dist/adapters/vercel/backend/chat.d.cts +2 -2
- package/dist/adapters/vercel/backend/chat.d.ts +2 -2
- package/dist/adapters/vercel/backend/embedding.d.cts +2 -2
- package/dist/adapters/vercel/backend/embedding.d.ts +2 -2
- package/dist/adapters/vercel/backend/utils.d.cts +2 -2
- package/dist/adapters/vercel/backend/utils.d.ts +2 -2
- package/dist/adapters/watsonx/backend/chat.cjs +3 -0
- package/dist/adapters/watsonx/backend/chat.cjs.map +1 -1
- package/dist/adapters/watsonx/backend/chat.d.cts +2 -2
- package/dist/adapters/watsonx/backend/chat.d.ts +2 -2
- package/dist/adapters/watsonx/backend/chat.js +3 -0
- package/dist/adapters/watsonx/backend/chat.js.map +1 -1
- package/dist/adapters/watsonx/backend/embedding.d.cts +2 -2
- package/dist/adapters/watsonx/backend/embedding.d.ts +2 -2
- package/dist/adapters/xai/backend/chat.d.cts +2 -2
- package/dist/adapters/xai/backend/chat.d.ts +2 -2
- package/dist/{agent-DIyHPkn2.d.ts → agent-CZGWXO-X.d.ts} +3 -3
- package/dist/{agent-CuJD7Szg.d.cts → agent-PRlGoawI.d.cts} +3 -3
- package/dist/agents/base.d.cts +2 -2
- package/dist/agents/base.d.ts +2 -2
- package/dist/agents/experimental/replan/agent.d.cts +3 -3
- package/dist/agents/experimental/replan/agent.d.ts +3 -3
- package/dist/agents/experimental/replan/prompts.d.cts +1 -1
- package/dist/agents/experimental/replan/prompts.d.ts +1 -1
- package/dist/agents/experimental/streamlit/agent.d.cts +3 -3
- package/dist/agents/experimental/streamlit/agent.d.ts +3 -3
- package/dist/agents/react/agent.d.cts +4 -4
- package/dist/agents/react/agent.d.ts +4 -4
- package/dist/agents/react/prompts.d.cts +1 -1
- package/dist/agents/react/prompts.d.ts +1 -1
- package/dist/agents/react/runners/base.d.cts +4 -4
- package/dist/agents/react/runners/base.d.ts +4 -4
- package/dist/agents/react/runners/deep-think/prompts.d.cts +1 -1
- package/dist/agents/react/runners/deep-think/prompts.d.ts +1 -1
- package/dist/agents/react/runners/deep-think/runner.d.cts +5 -5
- package/dist/agents/react/runners/deep-think/runner.d.ts +5 -5
- package/dist/agents/react/runners/default/runner.d.cts +5 -5
- package/dist/agents/react/runners/default/runner.d.ts +5 -5
- package/dist/agents/react/runners/granite/prompts.d.cts +1 -1
- package/dist/agents/react/runners/granite/prompts.d.ts +1 -1
- package/dist/agents/react/runners/granite/runner.d.cts +5 -5
- package/dist/agents/react/runners/granite/runner.d.ts +5 -5
- package/dist/agents/react/types.d.cts +2 -2
- package/dist/agents/react/types.d.ts +2 -2
- package/dist/agents/requirement/agent.d.cts +4 -4
- package/dist/agents/requirement/agent.d.ts +4 -4
- package/dist/agents/requirement/requirements/conditional.d.cts +4 -4
- package/dist/agents/requirement/requirements/conditional.d.ts +4 -4
- package/dist/agents/requirement/requirements/requirement.d.cts +4 -4
- package/dist/agents/requirement/requirements/requirement.d.ts +4 -4
- package/dist/agents/requirement/requirements/utils.d.cts +1 -1
- package/dist/agents/requirement/requirements/utils.d.ts +1 -1
- package/dist/agents/requirement/runner.cjs +12 -1
- package/dist/agents/requirement/runner.cjs.map +1 -1
- package/dist/agents/requirement/runner.d.cts +4 -4
- package/dist/agents/requirement/runner.d.ts +4 -4
- package/dist/agents/requirement/runner.js +12 -1
- package/dist/agents/requirement/runner.js.map +1 -1
- package/dist/agents/requirement/types.d.cts +4 -4
- package/dist/agents/requirement/types.d.ts +4 -4
- package/dist/agents/requirement/utils/llm.d.cts +4 -4
- package/dist/agents/requirement/utils/llm.d.ts +4 -4
- package/dist/agents/requirement/utils/tool.d.cts +4 -4
- package/dist/agents/requirement/utils/tool.d.ts +4 -4
- package/dist/agents/toolCalling/agent.d.cts +3 -3
- package/dist/agents/toolCalling/agent.d.ts +3 -3
- package/dist/agents/toolCalling/types.d.cts +1 -1
- package/dist/agents/toolCalling/types.d.ts +1 -1
- package/dist/agents/types.d.cts +2 -2
- package/dist/agents/types.d.ts +2 -2
- package/dist/backend/backend.d.cts +2 -2
- package/dist/backend/backend.d.ts +2 -2
- package/dist/backend/chat.d.cts +2 -2
- package/dist/backend/chat.d.ts +2 -2
- package/dist/backend/core.d.cts +2 -2
- package/dist/backend/core.d.ts +2 -2
- package/dist/backend/embedding.d.cts +2 -2
- package/dist/backend/embedding.d.ts +2 -2
- package/dist/backend/errors.d.cts +2 -2
- package/dist/backend/errors.d.ts +2 -2
- package/dist/backend/utils.d.cts +2 -2
- package/dist/backend/utils.d.ts +2 -2
- package/dist/{base-BfhNzUYf.d.ts → base-CyFx7BRL.d.ts} +1 -1
- package/dist/{base-BqzN2QwB.d.cts → base-XfWeXQ-S.d.cts} +1 -1
- package/dist/{chat-DaqV3woF.d.cts → chat-BFl85cqt.d.cts} +1 -1
- package/dist/{chat-DTxmaKP0.d.ts → chat-BRuyDeKR.d.ts} +1 -1
- package/dist/context.d.cts +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/emitter/emitter.d.cts +1 -1
- package/dist/emitter/emitter.d.ts +1 -1
- package/dist/emitter/types.d.cts +1 -1
- package/dist/emitter/types.d.ts +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/internals/fetcher.d.cts +1 -1
- package/dist/internals/fetcher.d.ts +1 -1
- package/dist/memory/summarizeMemory.d.cts +2 -2
- package/dist/memory/summarizeMemory.d.ts +2 -2
- package/dist/middleware/streamToolCall.d.cts +2 -2
- package/dist/middleware/streamToolCall.d.ts +2 -2
- package/dist/middleware/trajectory.d.cts +1 -1
- package/dist/middleware/trajectory.d.ts +1 -1
- package/dist/parsers/linePrefix.d.cts +1 -1
- package/dist/parsers/linePrefix.d.ts +1 -1
- package/dist/tools/arxiv.d.cts +1 -1
- package/dist/tools/arxiv.d.ts +1 -1
- package/dist/tools/base.d.cts +1 -1
- package/dist/tools/base.d.ts +1 -1
- package/dist/tools/calculator.d.cts +1 -1
- package/dist/tools/calculator.d.ts +1 -1
- package/dist/tools/custom.d.cts +2 -2
- package/dist/tools/custom.d.ts +2 -2
- package/dist/tools/database/elasticsearch.d.cts +1 -1
- package/dist/tools/database/elasticsearch.d.ts +1 -1
- package/dist/tools/database/milvus.d.cts +3 -3
- package/dist/tools/database/milvus.d.ts +3 -3
- package/dist/tools/database/qdrant.d.cts +1 -1
- package/dist/tools/database/qdrant.d.ts +1 -1
- package/dist/tools/database/sql.d.cts +1 -1
- package/dist/tools/database/sql.d.ts +1 -1
- package/dist/tools/handoff.d.cts +2 -2
- package/dist/tools/handoff.d.ts +2 -2
- package/dist/tools/llm.d.cts +2 -2
- package/dist/tools/llm.d.ts +2 -2
- package/dist/tools/mcp.d.cts +1 -1
- package/dist/tools/mcp.d.ts +1 -1
- package/dist/tools/openapi.d.cts +1 -1
- package/dist/tools/openapi.d.ts +1 -1
- package/dist/tools/python/output.d.cts +1 -1
- package/dist/tools/python/output.d.ts +1 -1
- package/dist/tools/python/python.d.cts +2 -2
- package/dist/tools/python/python.d.ts +2 -2
- package/dist/tools/search/base.d.cts +1 -1
- package/dist/tools/search/base.d.ts +1 -1
- package/dist/tools/search/duckDuckGoSearch.d.cts +1 -1
- package/dist/tools/search/duckDuckGoSearch.d.ts +1 -1
- package/dist/tools/search/googleSearch.d.cts +1 -1
- package/dist/tools/search/googleSearch.d.ts +1 -1
- package/dist/tools/search/searXNGSearch.d.cts +1 -1
- package/dist/tools/search/searXNGSearch.d.ts +1 -1
- package/dist/tools/search/wikipedia.d.cts +1 -1
- package/dist/tools/search/wikipedia.d.ts +1 -1
- package/dist/tools/similarity.d.cts +1 -1
- package/dist/tools/similarity.d.ts +1 -1
- package/dist/tools/think.d.cts +1 -1
- package/dist/tools/think.d.ts +1 -1
- package/dist/tools/weather/openMeteo.d.cts +1 -1
- package/dist/tools/weather/openMeteo.d.ts +1 -1
- package/dist/tools/web/webCrawler.d.cts +1 -1
- package/dist/tools/web/webCrawler.d.ts +1 -1
- package/dist/{types-YT-WdK3m.d.ts → types-BQ-3LdkE.d.ts} +3 -3
- package/dist/{types-YoNQSxQH.d.cts → types-CkEtV8R9.d.cts} +3 -3
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist/workflows/agent.d.cts +40 -40
- package/dist/workflows/agent.d.ts +40 -40
- package/dist/workflows/workflow.d.cts +1 -1
- package/dist/workflows/workflow.d.ts +1 -1
- package/package.json +1 -1
- package/dist/{emitter-CL56qab4.d.ts → emitter-36-9MnvA.d.ts} +1 -1
- package/dist/{emitter-UkIkNrek.d.cts → emitter-jN55XZZq.d.cts} +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/adapters/watsonx/backend/chat.ts"],"names":["Type","WatsonxChatModel","ChatModel","client","emitter","Emitter","root","child","namespace","creator","toolChoiceSupport","providerId","modelId","getEnv","WatsonxClient","ensure","config","name","parameters","undefined","NotImplementedError","_create","input","run","result","instance","textChat","prepareInput","signal","messages","finishReason","usage","extractOutput","choices","id","ChatModelOutput","_createStream","stream","textChatStream","returnObject","toolCallIds","Map","raw","aborted","controller","abort","data","map","delta","choice","message","toolCallIdsByName","extractToolCall","toolCallId","toolCallName","getLast","get","randomBytes","toString","set","toolName","findLast","Boolean","finish_reason","completionTokens","completion_tokens","promptTokens","prompt_tokens","totalTokens","total_tokens","flatMap","reasoning","reasoning_content","msg","AssistantMessage","type","text","push","content","tool_calls","length","chunks","toolCall","function","arguments","refusal","filter","isTruthy","overrides","tools","Promise","all","tool","description","getInputJsonSchema","toolConfig","toolChoice","toolChoiceOption","Tool","includes","ToolMessage","role","output","value","JSON","stringify","tool_call_id","SystemMessage","Error","toPlain","spaceId","projectId","isEmpty","responseFormat","JSON_OBJECT","topP","frequencyPenalty","temperature","n","maxTokens","presencePenalty","stop","stopSequences","seed","createSnapshot","shallowCopy","loadSnapshot","snapshot","Object","assign"],"mappings":";;;;;;;;;;;;;;;AA4BA,MAAOA,IAAAA,GAAO,iBAAA,CAAkB,sBAAA,CAAuB,SAAA,CAAU,IAAA;AAY1D,MAAMC,yBAAyBC,SAAAA,CAAAA;EAxCtC;;;;AAyCqBC,EAAAA,MAAAA;EACHC,OAAAA,GAA4BC,OAAAA,CAAQC,KAAKC,KAAAA,CAAM;IAC7DC,SAAAA,EAAW;AAAC,MAAA,SAAA;AAAW,MAAA,SAAA;AAAW,MAAA;;IAClCC,OAAAA,EAAS;GACX,CAAA;EACgBC,iBAAAA,GAAkD;AAAC,IAAA,MAAA;AAAQ,IAAA;;AAE3E,EAAA,IAAIC,UAAAA,GAAa;AACf,IAAA,OAAO,S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G,MAAMA,cAAAA,EAAAA;AACThH,MAAAA,OAAAA,EAAS,IAAA,CAAKA,OAAAA;MACdM,UAAAA,EAAY2G,WAAAA,CAAY,KAAK3G,UAAU,CAAA;AACvCf,MAAAA,MAAAA,EAAQ,IAAA,CAAKA;AACf,KAAA;AACF;AAEA2H,EAAAA,YAAAA,CAAaC,QAAAA,EAAkD;AAC7DC,IAAAA,MAAAA,CAAOC,MAAAA,CAAO,MAAMF,QAAAA,CAAAA;AACtB;AACF","file":"chat.js","sourcesContent":["/**\n * Copyright 2025 © BeeAI a Series of LF Projects, LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n ChatConfig,\n ChatModel,\n ChatModelEmitter,\n ChatModelInput,\n ChatModelOutput,\n ChatModelParameters,\n ChatModelToolChoiceSupport,\n} from \"@/backend/chat.js\";\nimport { WatsonxClient, WatsonxClientSettings } from \"@/adapters/watsonx/backend/client.js\";\nimport { findLast, isEmpty, isTruthy } from \"remeda\";\nimport WatsonxAiMlVml_v1, {\n TextChatMessages,\n TextChatParameterTools,\n TextChatParams,\n TextChatResultChoice,\n TextChatUsage,\n} from \"@ibm-cloud/watsonx-ai/dist/watsonx-ai-ml/vml_v1.js\";\nimport { shallowCopy } from \"@/serializer/utils.js\";\nimport { Emitter } from \"@/emitter/emitter.js\";\nimport { GetRunContext } from \"@/context.js\";\nimport { AssistantMessage, Message, SystemMessage, ToolMessage } from \"@/backend/message.js\";\nimport { ToolCallPart } from \"ai\";\nimport Type = WatsonxAiMlVml_v1.TextChatResponseFormat.Constants.Type;\nimport { getEnv } from \"@/internals/env.js\";\nimport { NotImplementedError } from \"@/errors.js\";\nimport { Tool } from \"@/tools/base.js\";\nimport type {\n TextChatMessageAssistant,\n TextChatMessageSystem,\n TextChatMessageTool,\n} from \"@ibm-cloud/watsonx-ai\";\nimport { getLast } from \"@/internals/helpers/object.js\";\nimport { randomBytes } from \"node:crypto\";\n\nexport class WatsonxChatModel extends ChatModel {\n protected readonly client: WatsonxClient;\n public readonly emitter: ChatModelEmitter = Emitter.root.child({\n namespace: [\"backend\", \"watsonx\", \"chat\"],\n creator: this,\n });\n public readonly toolChoiceSupport: ChatModelToolChoiceSupport[] = [\"none\", \"single\"];\n\n get providerId() {\n return \"watsonx\";\n }\n\n constructor(\n public readonly modelId = getEnv(\"WATSONX_CHAT_MODEL\", \"ibm/granite-3-8b-instruct\"),\n client?: WatsonxClient | WatsonxClientSettings,\n ) {\n super();\n this.client = WatsonxClient.ensure(client);\n }\n\n config(config: ChatConfig) {\n super.config(config);\n for (const name of [\"topK\"] as (keyof ChatModelParameters)[]) {\n if (this.parameters[name] !== undefined) {\n this.parameters[name] = undefined;\n throw new NotImplementedError(\n `Setting \"${name}\" parameter is not supported for WatsonX Chat Models.`,\n );\n }\n }\n return this;\n }\n\n protected async _create(input: ChatModelInput, run: GetRunContext<any>) {\n const { result } = await this.client.instance.textChat({\n ...(await this.prepareInput(input)),\n signal: run.signal,\n });\n const { messages, finishReason, usage } = this.extractOutput(\n result.choices,\n result.usage,\n result.id,\n );\n return new ChatModelOutput(messages, usage, finishReason);\n }\n\n async *_createStream(input: ChatModelInput, run: GetRunContext<this>) {\n // @ts-ignore\n const stream = await this.client.instance.textChatStream({\n ...(await this.prepareInput(input)),\n signal: run.signal,\n returnObject: true,\n });\n\n const toolCallIds = new Map<string, string>(); // toolName / id\n for await (const raw of stream) {\n if (run.signal.aborted) {\n stream.controller.abort(run.signal.aborted);\n break;\n }\n const { messages, finishReason, usage } = this.extractOutput(\n raw.data.choices.map(({ delta, ...choice }) => ({ ...choice, message: delta })),\n raw.data.usage,\n raw.data.id,\n toolCallIds,\n );\n yield new ChatModelOutput(messages, usage, finishReason);\n }\n }\n\n protected extractOutput(\n choices: TextChatResultChoice[],\n usage?: TextChatUsage,\n id?: string,\n toolCallIdsByName?: Map<string, string>,\n ) {\n if (!toolCallIdsByName) {\n toolCallIdsByName = new Map();\n }\n\n const extractToolCall = (\n toolCallId: string,\n toolCallName: string,\n ): Pick<ToolCallPart, \"toolName\" | \"toolCallId\"> => {\n // Some tool call parts don't have the 'id'\n // this function tries to guess it based on the previous chunks\n if (!toolCallName && !toolCallId) {\n [toolCallName, toolCallId] = getLast(toolCallIdsByName, [\"\", \"\"]);\n }\n if (!toolCallId) {\n toolCallId = toolCallIdsByName.get(toolCallName) || \"\";\n }\n if (!toolCallId) {\n toolCallId = `chatcmpl-tool-${randomBytes(16).toString(\"hex\")}`;\n }\n toolCallIdsByName.set(toolCallName, toolCallId);\n return {\n toolCallId: toolCallId,\n toolName: toolCallName,\n };\n };\n\n return {\n finishReason: findLast(choices, (choice) => Boolean(choice?.finish_reason))\n ?.finish_reason as ChatModelOutput[\"finishReason\"],\n usage: usage\n ? {\n completionTokens: usage.completion_tokens ?? 0,\n promptTokens: usage.prompt_tokens ?? 0,\n totalTokens: usage.total_tokens ?? 0,\n }\n : undefined,\n messages: choices\n .flatMap(({ message }) => {\n const messages: Message[] = [];\n\n // @ts-expect-error wrong types\n const reasoning = message?.reasoning_content;\n if (reasoning) {\n const msg = new AssistantMessage({ type: \"text\", text: reasoning }, {}, id);\n messages.push(msg);\n }\n if (message?.content) {\n const msg = new AssistantMessage({ type: \"text\", text: message.content }, {}, id);\n messages.push(msg);\n }\n if (message?.tool_calls && message.tool_calls.length > 0) {\n const chunks: ToolCallPart[] = [];\n for (const toolCall of message.tool_calls) {\n chunks.push({\n type: \"tool-call\",\n ...extractToolCall(toolCall.id, toolCall.function.name),\n input: toolCall.function.arguments,\n });\n }\n const msg = new AssistantMessage(chunks, {}, id);\n messages.push(msg);\n }\n if (message?.refusal) {\n const msg = new AssistantMessage({ type: \"text\", text: message.refusal }, {}, id);\n messages.push(msg);\n }\n return messages;\n })\n .filter(isTruthy),\n };\n }\n\n protected async prepareInput(overrides: ChatModelInput): Promise<TextChatParams> {\n const input: ChatModelInput = { ...this.parameters, ...overrides };\n const tools: TextChatParameterTools[] = await Promise.all(\n (input.tools ?? []).map(async (tool) => ({\n type: \"function\",\n function: {\n name: tool.name,\n description: tool.description,\n parameters: await tool.getInputJsonSchema(),\n },\n })),\n );\n\n const toolConfig: Pick<TextChatParams, \"toolChoice\" | \"toolChoiceOption\"> = {\n toolChoice: undefined,\n toolChoiceOption: undefined,\n };\n if (input.toolChoice) {\n if (input.toolChoice instanceof Tool) {\n toolConfig.toolChoice = {\n type: \"function\",\n function: { name: input.toolChoice.name },\n };\n } else if (this.toolChoiceSupport.includes(input.toolChoice)) {\n toolConfig.toolChoiceOption = input.toolChoice;\n }\n }\n\n return {\n modelId: this.modelId,\n messages: input.messages.flatMap((message): TextChatMessages[] => {\n if (message instanceof ToolMessage) {\n return message.content.map(\n (content): TextChatMessageTool => ({\n role: \"tool\",\n content:\n typeof content.output.value === \"string\"\n ? content.output.value\n : JSON.stringify(content),\n tool_call_id: content.toolCallId,\n }),\n );\n } else if (message instanceof SystemMessage) {\n return message.content.map(\n (content): TextChatMessageSystem => ({\n role: \"system\",\n content: content.text,\n }),\n );\n } else if (message instanceof AssistantMessage) {\n return message.content.map(\n (content): TextChatMessageAssistant => ({\n role: \"assistant\",\n ...(content.type === \"text\" && {\n content: content.text,\n }),\n ...(content.type === \"tool-call\" && {\n id: content.toolCallId,\n type: \"function\",\n function: {\n name: content.toolName,\n arguments: JSON.stringify(content.input),\n },\n }),\n ...(() => {\n if (content.type === \"file\") {\n throw new Error(\"Assistants cannot send a file in IBM watsonx\");\n }\n return {};\n })(),\n }),\n );\n } else {\n return [message.toPlain()];\n }\n }),\n spaceId: this.client.spaceId,\n projectId: this.client.projectId,\n tools: isEmpty(tools) ? undefined : tools,\n responseFormat: undefined,\n ...(input.responseFormat && {\n responseFormat: { type: Type.JSON_OBJECT },\n }),\n topP: input.topP,\n frequencyPenalty: input.frequencyPenalty,\n temperature: input.temperature,\n n: input.n,\n maxTokens: input.maxTokens,\n presencePenalty: input.presencePenalty,\n stop: input.stopSequences,\n seed: input.seed,\n ...toolConfig,\n };\n }\n\n createSnapshot() {\n return {\n ...super.createSnapshot(),\n modelId: this.modelId,\n parameters: shallowCopy(this.parameters),\n client: this.client,\n };\n }\n\n loadSnapshot(snapshot: ReturnType<typeof this.createSnapshot>) {\n Object.assign(this, snapshot);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/adapters/watsonx/backend/chat.ts"],"names":["Type","WatsonxChatModel","ChatModel","client","emitter","Emitter","root","child","namespace","creator","toolChoiceSupport","providerId","modelId","getEnv","WatsonxClient","ensure","config","name","parameters","undefined","NotImplementedError","_create","input","run","result","instance","textChat","prepareInput","signal","messages","finishReason","usage","extractOutput","choices","id","ChatModelOutput","_createStream","stream","textChatStream","returnObject","toolCallIds","Map","raw","aborted","controller","abort","Array","isArray","data","map","delta","choice","message","toolCallIdsByName","extractToolCall","toolCallId","toolCallName","getLast","get","randomBytes","toString","set","toolName","findLast","Boolean","finish_reason","completionTokens","completion_tokens","promptTokens","prompt_tokens","totalTokens","total_tokens","flatMap","reasoning","reasoning_content","msg","AssistantMessage","type","text","push","content","tool_calls","length","chunks","toolCall","function","arguments","refusal","filter","isTruthy","overrides","tools","Promise","all","tool","description","getInputJsonSchema","toolConfig","toolChoice","toolChoiceOption","Tool","includes","ToolMessage","role","output","value","JSON","stringify","tool_call_id","SystemMessage","Error","toPlain","spaceId","projectId","isEmpty","responseFormat","JSON_OBJECT","topP","frequencyPenalty","temperature","n","maxTokens","presencePenalty","stop","stopSequences","seed","createSnapshot","shallowCopy","loadSnapshot","snapshot","Object","assign"],"mappings":";;;;;;;;;;;;;;;AA4BA,MAAOA,IAAAA,GAAO,iBAAA,CAAkB,sBAAA,CAAuB,SAAA,CAAU,IAAA;AAY1D,MAAMC,yBAAyBC,SAAAA,CAAAA;EAxCtC;;;;AAyCqBC,EAAAA,MAAAA;EACHC,OAAAA,GAA4BC,OAAAA,CAAQC,KAAKC,KAAAA,CAAM;IAC7DC,SAAAA,EAAW;AAAC,MAAA,SAAA;AAAW,MAAA,SAAA;AAAW,MAAA;;IAClCC,OAAAA,EAAS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A;AACjBC,MAAAA,eAAAA,EAAiBpG,KAAAA,CAAMoG,eAAAA;AACvBC,MAAAA,IAAAA,EAAMrG,KAAAA,CAAMsG,aAAAA;AACZC,MAAAA,IAAAA,EAAMvG,KAAAA,CAAMuG,IAAAA;MACZ,GAAG5B;AACL,KAAA;AACF;EAEA6B,cAAAA,GAAiB;AACf,IAAA,OAAO;AACL,MAAA,GAAG,MAAMA,cAAAA,EAAAA;AACTlH,MAAAA,OAAAA,EAAS,IAAA,CAAKA,OAAAA;MACdM,UAAAA,EAAY6G,WAAAA,CAAY,KAAK7G,UAAU,CAAA;AACvCf,MAAAA,MAAAA,EAAQ,IAAA,CAAKA;AACf,KAAA;AACF;AAEA6H,EAAAA,YAAAA,CAAaC,QAAAA,EAAkD;AAC7DC,IAAAA,MAAAA,CAAOC,MAAAA,CAAO,MAAMF,QAAAA,CAAAA;AACtB;AACF","file":"chat.js","sourcesContent":["/**\n * Copyright 2025 © BeeAI a Series of LF Projects, LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport {\n ChatConfig,\n ChatModel,\n ChatModelEmitter,\n ChatModelInput,\n ChatModelOutput,\n ChatModelParameters,\n ChatModelToolChoiceSupport,\n} from \"@/backend/chat.js\";\nimport { WatsonxClient, WatsonxClientSettings } from \"@/adapters/watsonx/backend/client.js\";\nimport { findLast, isEmpty, isTruthy } from \"remeda\";\nimport WatsonxAiMlVml_v1, {\n TextChatMessages,\n TextChatParameterTools,\n TextChatParams,\n TextChatResultChoice,\n TextChatUsage,\n} from \"@ibm-cloud/watsonx-ai/dist/watsonx-ai-ml/vml_v1.js\";\nimport { shallowCopy } from \"@/serializer/utils.js\";\nimport { Emitter } from \"@/emitter/emitter.js\";\nimport { GetRunContext } from \"@/context.js\";\nimport { AssistantMessage, Message, SystemMessage, ToolMessage } from \"@/backend/message.js\";\nimport { ToolCallPart } from \"ai\";\nimport Type = WatsonxAiMlVml_v1.TextChatResponseFormat.Constants.Type;\nimport { getEnv } from \"@/internals/env.js\";\nimport { NotImplementedError } from \"@/errors.js\";\nimport { Tool } from \"@/tools/base.js\";\nimport type {\n TextChatMessageAssistant,\n TextChatMessageSystem,\n TextChatMessageTool,\n} from \"@ibm-cloud/watsonx-ai\";\nimport { getLast } from \"@/internals/helpers/object.js\";\nimport { randomBytes } from \"node:crypto\";\n\nexport class WatsonxChatModel extends ChatModel {\n protected readonly client: WatsonxClient;\n public readonly emitter: ChatModelEmitter = Emitter.root.child({\n namespace: [\"backend\", \"watsonx\", \"chat\"],\n creator: this,\n });\n public readonly toolChoiceSupport: ChatModelToolChoiceSupport[] = [\"none\", \"single\"];\n\n get providerId() {\n return \"watsonx\";\n }\n\n constructor(\n public readonly modelId = getEnv(\"WATSONX_CHAT_MODEL\", \"ibm/granite-3-8b-instruct\"),\n client?: WatsonxClient | WatsonxClientSettings,\n ) {\n super();\n this.client = WatsonxClient.ensure(client);\n }\n\n config(config: ChatConfig) {\n super.config(config);\n for (const name of [\"topK\"] as (keyof ChatModelParameters)[]) {\n if (this.parameters[name] !== undefined) {\n this.parameters[name] = undefined;\n throw new NotImplementedError(\n `Setting \"${name}\" parameter is not supported for WatsonX Chat Models.`,\n );\n }\n }\n return this;\n }\n\n protected async _create(input: ChatModelInput, run: GetRunContext<any>) {\n const { result } = await this.client.instance.textChat({\n ...(await this.prepareInput(input)),\n signal: run.signal,\n });\n const { messages, finishReason, usage } = this.extractOutput(\n result.choices,\n result.usage,\n result.id,\n );\n return new ChatModelOutput(messages, usage, finishReason);\n }\n\n async *_createStream(input: ChatModelInput, run: GetRunContext<this>) {\n // @ts-ignore\n const stream = await this.client.instance.textChatStream({\n ...(await this.prepareInput(input)),\n signal: run.signal,\n returnObject: true,\n });\n\n const toolCallIds = new Map<string, string>(); // toolName / id\n for await (const raw of stream) {\n if (run.signal.aborted) {\n stream.controller.abort(run.signal.aborted);\n break;\n }\n if (!Array.isArray(raw.data?.choices)) {\n continue;\n }\n const { messages, finishReason, usage } = this.extractOutput(\n raw.data.choices.map(({ delta, ...choice }) => ({ ...choice, message: delta })),\n raw.data.usage,\n raw.data.id,\n toolCallIds,\n );\n yield new ChatModelOutput(messages, usage, finishReason);\n }\n }\n\n protected extractOutput(\n choices: TextChatResultChoice[],\n usage?: TextChatUsage,\n id?: string,\n toolCallIdsByName?: Map<string, string>,\n ) {\n if (!toolCallIdsByName) {\n toolCallIdsByName = new Map();\n }\n\n const extractToolCall = (\n toolCallId: string,\n toolCallName: string,\n ): Pick<ToolCallPart, \"toolName\" | \"toolCallId\"> => {\n // Some tool call parts don't have the 'id'\n // this function tries to guess it based on the previous chunks\n if (!toolCallName && !toolCallId) {\n [toolCallName, toolCallId] = getLast(toolCallIdsByName, [\"\", \"\"]);\n }\n if (!toolCallId) {\n toolCallId = toolCallIdsByName.get(toolCallName) || \"\";\n }\n if (!toolCallId) {\n toolCallId = `chatcmpl-tool-${randomBytes(16).toString(\"hex\")}`;\n }\n toolCallIdsByName.set(toolCallName, toolCallId);\n return {\n toolCallId: toolCallId,\n toolName: toolCallName,\n };\n };\n\n return {\n finishReason: findLast(choices, (choice) => Boolean(choice?.finish_reason))\n ?.finish_reason as ChatModelOutput[\"finishReason\"],\n usage: usage\n ? {\n completionTokens: usage.completion_tokens ?? 0,\n promptTokens: usage.prompt_tokens ?? 0,\n totalTokens: usage.total_tokens ?? 0,\n }\n : undefined,\n messages: choices\n .flatMap(({ message }) => {\n const messages: Message[] = [];\n\n // @ts-expect-error wrong types\n const reasoning = message?.reasoning_content;\n if (reasoning) {\n const msg = new AssistantMessage({ type: \"text\", text: reasoning }, {}, id);\n messages.push(msg);\n }\n if (message?.content) {\n const msg = new AssistantMessage({ type: \"text\", text: message.content }, {}, id);\n messages.push(msg);\n }\n if (message?.tool_calls && message.tool_calls.length > 0) {\n const chunks: ToolCallPart[] = [];\n for (const toolCall of message.tool_calls) {\n chunks.push({\n type: \"tool-call\",\n ...extractToolCall(toolCall.id, toolCall.function.name),\n input: toolCall.function.arguments,\n });\n }\n const msg = new AssistantMessage(chunks, {}, id);\n messages.push(msg);\n }\n if (message?.refusal) {\n const msg = new AssistantMessage({ type: \"text\", text: message.refusal }, {}, id);\n messages.push(msg);\n }\n return messages;\n })\n .filter(isTruthy),\n };\n }\n\n protected async prepareInput(overrides: ChatModelInput): Promise<TextChatParams> {\n const input: ChatModelInput = { ...this.parameters, ...overrides };\n const tools: TextChatParameterTools[] = await Promise.all(\n (input.tools ?? []).map(async (tool) => ({\n type: \"function\",\n function: {\n name: tool.name,\n description: tool.description,\n parameters: await tool.getInputJsonSchema(),\n },\n })),\n );\n\n const toolConfig: Pick<TextChatParams, \"toolChoice\" | \"toolChoiceOption\"> = {\n toolChoice: undefined,\n toolChoiceOption: undefined,\n };\n if (input.toolChoice) {\n if (input.toolChoice instanceof Tool) {\n toolConfig.toolChoice = {\n type: \"function\",\n function: { name: input.toolChoice.name },\n };\n } else if (this.toolChoiceSupport.includes(input.toolChoice)) {\n toolConfig.toolChoiceOption = input.toolChoice;\n }\n }\n\n return {\n modelId: this.modelId,\n messages: input.messages.flatMap((message): TextChatMessages[] => {\n if (message instanceof ToolMessage) {\n return message.content.map(\n (content): TextChatMessageTool => ({\n role: \"tool\",\n content:\n typeof content.output.value === \"string\"\n ? content.output.value\n : JSON.stringify(content),\n tool_call_id: content.toolCallId,\n }),\n );\n } else if (message instanceof SystemMessage) {\n return message.content.map(\n (content): TextChatMessageSystem => ({\n role: \"system\",\n content: content.text,\n }),\n );\n } else if (message instanceof AssistantMessage) {\n return message.content.map(\n (content): TextChatMessageAssistant => ({\n role: \"assistant\",\n ...(content.type === \"text\" && {\n content: content.text,\n }),\n ...(content.type === \"tool-call\" && {\n id: content.toolCallId,\n type: \"function\",\n function: {\n name: content.toolName,\n arguments: JSON.stringify(content.input),\n },\n }),\n ...(() => {\n if (content.type === \"file\") {\n throw new Error(\"Assistants cannot send a file in IBM watsonx\");\n }\n return {};\n })(),\n }),\n );\n } else {\n return [message.toPlain()];\n }\n }),\n spaceId: this.client.spaceId,\n projectId: this.client.projectId,\n tools: isEmpty(tools) ? undefined : tools,\n responseFormat: undefined,\n ...(input.responseFormat && {\n responseFormat: { type: Type.JSON_OBJECT },\n }),\n topP: input.topP,\n frequencyPenalty: input.frequencyPenalty,\n temperature: input.temperature,\n n: input.n,\n maxTokens: input.maxTokens,\n presencePenalty: input.presencePenalty,\n stop: input.stopSequences,\n seed: input.seed,\n ...toolConfig,\n };\n }\n\n createSnapshot() {\n return {\n ...super.createSnapshot(),\n modelId: this.modelId,\n parameters: shallowCopy(this.parameters),\n client: this.client,\n };\n }\n\n loadSnapshot(snapshot: ReturnType<typeof this.createSnapshot>) {\n Object.assign(this, snapshot);\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WatsonxClient, WatsonxClientSettings } from './client.cjs';
|
|
2
2
|
import { EmbeddingModel, EmbeddingModelEvents, EmbeddingModelInput, EmbeddingModelOutput } from '../../../backend/embedding.cjs';
|
|
3
3
|
import { EmbeddingParameters } from '@ibm-cloud/watsonx-ai/dist/watsonx-ai-ml/vml_v1.js';
|
|
4
|
-
import { E as Emitter } from '../../../emitter-
|
|
4
|
+
import { E as Emitter } from '../../../emitter-jN55XZZq.cjs';
|
|
5
5
|
import '@ibm-cloud/watsonx-ai';
|
|
6
6
|
import 'ibm-cloud-sdk-core';
|
|
7
7
|
import '../../../backend/client.cjs';
|
|
@@ -11,7 +11,7 @@ import '../../../internals/helpers/guards.cjs';
|
|
|
11
11
|
import '../../../context.cjs';
|
|
12
12
|
import '../../../internals/helpers/promise.cjs';
|
|
13
13
|
import '../../../errors.cjs';
|
|
14
|
-
import '../../../chat-
|
|
14
|
+
import '../../../chat-BFl85cqt.cjs';
|
|
15
15
|
import '../../../backend/message.cjs';
|
|
16
16
|
import 'ai';
|
|
17
17
|
import 'promise-based-task';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WatsonxClient, WatsonxClientSettings } from './client.js';
|
|
2
2
|
import { EmbeddingModel, EmbeddingModelEvents, EmbeddingModelInput, EmbeddingModelOutput } from '../../../backend/embedding.js';
|
|
3
3
|
import { EmbeddingParameters } from '@ibm-cloud/watsonx-ai/dist/watsonx-ai-ml/vml_v1.js';
|
|
4
|
-
import { E as Emitter } from '../../../emitter-
|
|
4
|
+
import { E as Emitter } from '../../../emitter-36-9MnvA.js';
|
|
5
5
|
import '@ibm-cloud/watsonx-ai';
|
|
6
6
|
import 'ibm-cloud-sdk-core';
|
|
7
7
|
import '../../../backend/client.js';
|
|
@@ -11,7 +11,7 @@ import '../../../internals/helpers/guards.js';
|
|
|
11
11
|
import '../../../context.js';
|
|
12
12
|
import '../../../internals/helpers/promise.js';
|
|
13
13
|
import '../../../errors.js';
|
|
14
|
-
import '../../../chat-
|
|
14
|
+
import '../../../chat-BRuyDeKR.js';
|
|
15
15
|
import '../../../backend/message.js';
|
|
16
16
|
import 'ai';
|
|
17
17
|
import 'promise-based-task';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VercelChatModel } from '../../vercel/backend/chat.cjs';
|
|
2
2
|
import { XaiClientSettings, XaiClient } from './client.cjs';
|
|
3
3
|
import { XaiProvider } from '@ai-sdk/xai';
|
|
4
|
-
import { C as ChatModelParameters } from '../../../chat-
|
|
4
|
+
import { C as ChatModelParameters } from '../../../chat-BFl85cqt.cjs';
|
|
5
5
|
import '../../../logger/logger.cjs';
|
|
6
6
|
import 'pino';
|
|
7
7
|
import '../../../errors.cjs';
|
|
@@ -9,7 +9,7 @@ import '../../../internals/types.cjs';
|
|
|
9
9
|
import '../../../internals/helpers/guards.cjs';
|
|
10
10
|
import '../../../internals/serializable.cjs';
|
|
11
11
|
import '../../../context.cjs';
|
|
12
|
-
import '../../../emitter-
|
|
12
|
+
import '../../../emitter-jN55XZZq.cjs';
|
|
13
13
|
import '../../../internals/helpers/promise.cjs';
|
|
14
14
|
import 'ai';
|
|
15
15
|
import '../../../backend/message.cjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VercelChatModel } from '../../vercel/backend/chat.js';
|
|
2
2
|
import { XaiClientSettings, XaiClient } from './client.js';
|
|
3
3
|
import { XaiProvider } from '@ai-sdk/xai';
|
|
4
|
-
import { C as ChatModelParameters } from '../../../chat-
|
|
4
|
+
import { C as ChatModelParameters } from '../../../chat-BRuyDeKR.js';
|
|
5
5
|
import '../../../logger/logger.js';
|
|
6
6
|
import 'pino';
|
|
7
7
|
import '../../../errors.js';
|
|
@@ -9,7 +9,7 @@ import '../../../internals/types.js';
|
|
|
9
9
|
import '../../../internals/helpers/guards.js';
|
|
10
10
|
import '../../../internals/serializable.js';
|
|
11
11
|
import '../../../context.js';
|
|
12
|
-
import '../../../emitter-
|
|
12
|
+
import '../../../emitter-36-9MnvA.js';
|
|
13
13
|
import '../../../internals/helpers/promise.js';
|
|
14
14
|
import 'ai';
|
|
15
15
|
import '../../../backend/message.js';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { GetRunContext, RunContext, MiddlewareType } from './context.js';
|
|
2
|
-
import { c as AgentMeta, a as BaseAgent } from './base-
|
|
2
|
+
import { c as AgentMeta, a as BaseAgent } from './base-CyFx7BRL.js';
|
|
3
3
|
import { AnyTool } from './tools/base.js';
|
|
4
4
|
import { BaseMemory } from './memory/base.js';
|
|
5
|
-
import { E as Emitter } from './emitter-
|
|
5
|
+
import { E as Emitter } from './emitter-36-9MnvA.js';
|
|
6
6
|
import { ReActAgentRunOptions, ReActAgentRunIteration, ReActAgentCallbacks, ReActAgentParserInput, ReActAgentMeta, ReActAgentRunInput, ReActAgentIterationToolResult, ReActAgentTemplates, ReActAgentExecutionConfig, ReActAgentRunOutput } from './agents/react/types.js';
|
|
7
7
|
import { LinePrefixParser } from './parsers/linePrefix.js';
|
|
8
8
|
import { Serializable } from './internals/serializable.js';
|
|
9
|
-
import { m as ChatModel } from './chat-
|
|
9
|
+
import { m as ChatModel } from './chat-BRuyDeKR.js';
|
|
10
10
|
import { RetryCounter } from './internals/helpers/counter.js';
|
|
11
11
|
|
|
12
12
|
interface ReActAgentRunnerLLMInput {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { GetRunContext, RunContext, MiddlewareType } from './context.cjs';
|
|
2
|
-
import { c as AgentMeta, a as BaseAgent } from './base-
|
|
2
|
+
import { c as AgentMeta, a as BaseAgent } from './base-XfWeXQ-S.cjs';
|
|
3
3
|
import { AnyTool } from './tools/base.cjs';
|
|
4
4
|
import { BaseMemory } from './memory/base.cjs';
|
|
5
|
-
import { E as Emitter } from './emitter-
|
|
5
|
+
import { E as Emitter } from './emitter-jN55XZZq.cjs';
|
|
6
6
|
import { ReActAgentRunOptions, ReActAgentRunIteration, ReActAgentCallbacks, ReActAgentParserInput, ReActAgentMeta, ReActAgentRunInput, ReActAgentIterationToolResult, ReActAgentTemplates, ReActAgentExecutionConfig, ReActAgentRunOutput } from './agents/react/types.cjs';
|
|
7
7
|
import { LinePrefixParser } from './parsers/linePrefix.cjs';
|
|
8
8
|
import { Serializable } from './internals/serializable.cjs';
|
|
9
|
-
import { m as ChatModel } from './chat-
|
|
9
|
+
import { m as ChatModel } from './chat-BFl85cqt.cjs';
|
|
10
10
|
import { RetryCounter } from './internals/helpers/counter.cjs';
|
|
11
11
|
|
|
12
12
|
interface ReActAgentRunnerLLMInput {
|
package/dist/agents/base.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import '../context.cjs';
|
|
2
2
|
import '../errors.cjs';
|
|
3
|
-
export { A as AgentError, a as BaseAgent, B as BaseAgentRunOptions } from '../base-
|
|
3
|
+
export { A as AgentError, a as BaseAgent, B as BaseAgentRunOptions } from '../base-XfWeXQ-S.cjs';
|
|
4
4
|
import '../internals/serializable.cjs';
|
|
5
|
-
import '../emitter-
|
|
5
|
+
import '../emitter-jN55XZZq.cjs';
|
|
6
6
|
import '../memory/base.cjs';
|
|
7
7
|
import '../internals/helpers/promise.cjs';
|
|
8
8
|
import '../internals/types.cjs';
|
package/dist/agents/base.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import '../context.js';
|
|
2
2
|
import '../errors.js';
|
|
3
|
-
export { A as AgentError, a as BaseAgent, B as BaseAgentRunOptions } from '../base-
|
|
3
|
+
export { A as AgentError, a as BaseAgent, B as BaseAgentRunOptions } from '../base-CyFx7BRL.js';
|
|
4
4
|
import '../internals/serializable.js';
|
|
5
|
-
import '../emitter-
|
|
5
|
+
import '../emitter-36-9MnvA.js';
|
|
6
6
|
import '../memory/base.js';
|
|
7
7
|
import '../internals/helpers/promise.js';
|
|
8
8
|
import '../internals/types.js';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { C as Callback, E as Emitter } from '../../../emitter-
|
|
2
|
-
import { a as BaseAgent, B as BaseAgentRunOptions } from '../../../base-
|
|
1
|
+
import { C as Callback, E as Emitter } from '../../../emitter-jN55XZZq.cjs';
|
|
2
|
+
import { a as BaseAgent, B as BaseAgentRunOptions } from '../../../base-XfWeXQ-S.cjs';
|
|
3
3
|
import { GetRunContext } from '../../../context.cjs';
|
|
4
4
|
import { Message } from '../../../backend/message.cjs';
|
|
5
5
|
import { RePlanState } from './prompts.cjs';
|
|
6
6
|
import { BaseMemory } from '../../../memory/base.cjs';
|
|
7
7
|
import { UnconstrainedMemory } from '../../../memory/unconstrainedMemory.cjs';
|
|
8
8
|
import { AnyTool } from '../../../tools/base.cjs';
|
|
9
|
-
import { m as ChatModel } from '../../../chat-
|
|
9
|
+
import { m as ChatModel } from '../../../chat-BFl85cqt.cjs';
|
|
10
10
|
import '../../../internals/types.cjs';
|
|
11
11
|
import '../../../internals/helpers/guards.cjs';
|
|
12
12
|
import '../../../internals/serializable.cjs';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { C as Callback, E as Emitter } from '../../../emitter-
|
|
2
|
-
import { a as BaseAgent, B as BaseAgentRunOptions } from '../../../base-
|
|
1
|
+
import { C as Callback, E as Emitter } from '../../../emitter-36-9MnvA.js';
|
|
2
|
+
import { a as BaseAgent, B as BaseAgentRunOptions } from '../../../base-CyFx7BRL.js';
|
|
3
3
|
import { GetRunContext } from '../../../context.js';
|
|
4
4
|
import { Message } from '../../../backend/message.js';
|
|
5
5
|
import { RePlanState } from './prompts.js';
|
|
6
6
|
import { BaseMemory } from '../../../memory/base.js';
|
|
7
7
|
import { UnconstrainedMemory } from '../../../memory/unconstrainedMemory.js';
|
|
8
8
|
import { AnyTool } from '../../../tools/base.js';
|
|
9
|
-
import { m as ChatModel } from '../../../chat-
|
|
9
|
+
import { m as ChatModel } from '../../../chat-BRuyDeKR.js';
|
|
10
10
|
import '../../../internals/types.js';
|
|
11
11
|
import '../../../internals/helpers/guards.js';
|
|
12
12
|
import '../../../internals/serializable.js';
|
|
@@ -7,7 +7,7 @@ import '../../../internals/types.cjs';
|
|
|
7
7
|
import '../../../internals/helpers/guards.cjs';
|
|
8
8
|
import '../../../internals/serializable.cjs';
|
|
9
9
|
import '../../../context.cjs';
|
|
10
|
-
import '../../../emitter-
|
|
10
|
+
import '../../../emitter-jN55XZZq.cjs';
|
|
11
11
|
import '../../../internals/helpers/promise.cjs';
|
|
12
12
|
import 'promise-based-task';
|
|
13
13
|
import '../../../cache/base.cjs';
|
|
@@ -7,7 +7,7 @@ import '../../../internals/types.js';
|
|
|
7
7
|
import '../../../internals/helpers/guards.js';
|
|
8
8
|
import '../../../internals/serializable.js';
|
|
9
9
|
import '../../../context.js';
|
|
10
|
-
import '../../../emitter-
|
|
10
|
+
import '../../../emitter-36-9MnvA.js';
|
|
11
11
|
import '../../../internals/helpers/promise.js';
|
|
12
12
|
import 'promise-based-task';
|
|
13
13
|
import '../../../cache/base.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { GetRunContext, MiddlewareType } from '../../../context.cjs';
|
|
2
|
-
import { a as BaseAgent, c as AgentMeta, B as BaseAgentRunOptions } from '../../../base-
|
|
3
|
-
import { C as Callback, E as Emitter } from '../../../emitter-
|
|
2
|
+
import { a as BaseAgent, c as AgentMeta, B as BaseAgentRunOptions } from '../../../base-XfWeXQ-S.cjs';
|
|
3
|
+
import { C as Callback, E as Emitter } from '../../../emitter-jN55XZZq.cjs';
|
|
4
4
|
import { BaseMemory } from '../../../memory/base.cjs';
|
|
5
5
|
import { Message, UserMessage } from '../../../backend/message.cjs';
|
|
6
6
|
import { StreamlitAgentTemplates } from './prompts.cjs';
|
|
7
7
|
import { TokenMemory } from '../../../memory/tokenMemory.cjs';
|
|
8
|
-
import { m as ChatModel, n as ChatModelOutput } from '../../../chat-
|
|
8
|
+
import { m as ChatModel, n as ChatModelOutput } from '../../../chat-BFl85cqt.cjs';
|
|
9
9
|
import '../../../internals/serializable.cjs';
|
|
10
10
|
import '../../../internals/types.cjs';
|
|
11
11
|
import '../../../internals/helpers/guards.cjs';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { GetRunContext, MiddlewareType } from '../../../context.js';
|
|
2
|
-
import { a as BaseAgent, c as AgentMeta, B as BaseAgentRunOptions } from '../../../base-
|
|
3
|
-
import { C as Callback, E as Emitter } from '../../../emitter-
|
|
2
|
+
import { a as BaseAgent, c as AgentMeta, B as BaseAgentRunOptions } from '../../../base-CyFx7BRL.js';
|
|
3
|
+
import { C as Callback, E as Emitter } from '../../../emitter-36-9MnvA.js';
|
|
4
4
|
import { BaseMemory } from '../../../memory/base.js';
|
|
5
5
|
import { Message, UserMessage } from '../../../backend/message.js';
|
|
6
6
|
import { StreamlitAgentTemplates } from './prompts.js';
|
|
7
7
|
import { TokenMemory } from '../../../memory/tokenMemory.js';
|
|
8
|
-
import { m as ChatModel, n as ChatModelOutput } from '../../../chat-
|
|
8
|
+
import { m as ChatModel, n as ChatModelOutput } from '../../../chat-BRuyDeKR.js';
|
|
9
9
|
import '../../../internals/serializable.js';
|
|
10
10
|
import '../../../internals/types.js';
|
|
11
11
|
import '../../../internals/helpers/guards.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import '../../context.cjs';
|
|
2
|
-
import '../../base-
|
|
2
|
+
import '../../base-XfWeXQ-S.cjs';
|
|
3
3
|
import '../../tools/base.cjs';
|
|
4
4
|
import '../../memory/base.cjs';
|
|
5
|
-
import '../../emitter-
|
|
5
|
+
import '../../emitter-jN55XZZq.cjs';
|
|
6
6
|
import './types.cjs';
|
|
7
|
-
export { a as ReActAgent, R as ReActAgentInput, d as ReActAgentTemplateFactory } from '../../agent-
|
|
8
|
-
import '../../chat-
|
|
7
|
+
export { a as ReActAgent, R as ReActAgentInput, d as ReActAgentTemplateFactory } from '../../agent-PRlGoawI.cjs';
|
|
8
|
+
import '../../chat-BFl85cqt.cjs';
|
|
9
9
|
import '../../internals/serializable.cjs';
|
|
10
10
|
import '../../internals/types.cjs';
|
|
11
11
|
import '../../internals/helpers/guards.cjs';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import '../../context.js';
|
|
2
|
-
import '../../base-
|
|
2
|
+
import '../../base-CyFx7BRL.js';
|
|
3
3
|
import '../../tools/base.js';
|
|
4
4
|
import '../../memory/base.js';
|
|
5
|
-
import '../../emitter-
|
|
5
|
+
import '../../emitter-36-9MnvA.js';
|
|
6
6
|
import './types.js';
|
|
7
|
-
export { a as ReActAgent, R as ReActAgentInput, d as ReActAgentTemplateFactory } from '../../agent-
|
|
8
|
-
import '../../chat-
|
|
7
|
+
export { a as ReActAgent, R as ReActAgentInput, d as ReActAgentTemplateFactory } from '../../agent-CZGWXO-X.js';
|
|
8
|
+
import '../../chat-BRuyDeKR.js';
|
|
9
9
|
import '../../internals/serializable.js';
|
|
10
10
|
import '../../internals/types.js';
|
|
11
11
|
import '../../internals/helpers/guards.js';
|
|
@@ -28,12 +28,12 @@ declare const ReActAgentSystemPrompt: PromptTemplate<z.ZodObject<{
|
|
|
28
28
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
29
29
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
instructions: string;
|
|
32
31
|
tools: z.objectOutputType<{
|
|
33
32
|
name: z.ZodString;
|
|
34
33
|
description: z.ZodString;
|
|
35
34
|
schema: z.ZodString;
|
|
36
35
|
}, z.ZodTypeAny, "passthrough">[];
|
|
36
|
+
instructions: string;
|
|
37
37
|
createdAt?: string | null | undefined;
|
|
38
38
|
}, {
|
|
39
39
|
tools: z.objectInputType<{
|
|
@@ -28,12 +28,12 @@ declare const ReActAgentSystemPrompt: PromptTemplate<z.ZodObject<{
|
|
|
28
28
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
29
29
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
instructions: string;
|
|
32
31
|
tools: z.objectOutputType<{
|
|
33
32
|
name: z.ZodString;
|
|
34
33
|
description: z.ZodString;
|
|
35
34
|
schema: z.ZodString;
|
|
36
35
|
}, z.ZodTypeAny, "passthrough">[];
|
|
36
|
+
instructions: string;
|
|
37
37
|
createdAt?: string | null | undefined;
|
|
38
38
|
}, {
|
|
39
39
|
tools: z.objectInputType<{
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import '../../../parsers/linePrefix.cjs';
|
|
2
2
|
import '../types.cjs';
|
|
3
3
|
import '../../../internals/serializable.cjs';
|
|
4
|
-
export { B as BaseRunner, b as ReActAgentRunnerLLMInput, c as ReActAgentRunnerToolInput } from '../../../agent-
|
|
4
|
+
export { B as BaseRunner, b as ReActAgentRunnerLLMInput, c as ReActAgentRunnerToolInput } from '../../../agent-PRlGoawI.cjs';
|
|
5
5
|
import '../../../internals/helpers/counter.cjs';
|
|
6
6
|
import '../../../memory/base.cjs';
|
|
7
7
|
import '../../../context.cjs';
|
|
8
|
-
import '../../../emitter-
|
|
8
|
+
import '../../../emitter-jN55XZZq.cjs';
|
|
9
9
|
import 'node_modules/remeda/dist/ToString-DKW-jYvM.js';
|
|
10
10
|
import '../../../parsers/field.cjs';
|
|
11
11
|
import 'zod';
|
|
@@ -26,8 +26,8 @@ import 'zod-to-json-schema';
|
|
|
26
26
|
import '../../../internals/helpers/promise.cjs';
|
|
27
27
|
import '../prompts.cjs';
|
|
28
28
|
import '../../../template.cjs';
|
|
29
|
-
import '../../../chat-
|
|
29
|
+
import '../../../chat-BFl85cqt.cjs';
|
|
30
30
|
import '../../../backend/constants.cjs';
|
|
31
31
|
import '../../../logger/logger.cjs';
|
|
32
32
|
import 'pino';
|
|
33
|
-
import '../../../base-
|
|
33
|
+
import '../../../base-XfWeXQ-S.cjs';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import '../../../parsers/linePrefix.js';
|
|
2
2
|
import '../types.js';
|
|
3
3
|
import '../../../internals/serializable.js';
|
|
4
|
-
export { B as BaseRunner, b as ReActAgentRunnerLLMInput, c as ReActAgentRunnerToolInput } from '../../../agent-
|
|
4
|
+
export { B as BaseRunner, b as ReActAgentRunnerLLMInput, c as ReActAgentRunnerToolInput } from '../../../agent-CZGWXO-X.js';
|
|
5
5
|
import '../../../internals/helpers/counter.js';
|
|
6
6
|
import '../../../memory/base.js';
|
|
7
7
|
import '../../../context.js';
|
|
8
|
-
import '../../../emitter-
|
|
8
|
+
import '../../../emitter-36-9MnvA.js';
|
|
9
9
|
import 'node_modules/remeda/dist/ToString-DKW-jYvM.js';
|
|
10
10
|
import '../../../parsers/field.js';
|
|
11
11
|
import 'zod';
|
|
@@ -26,8 +26,8 @@ import 'zod-to-json-schema';
|
|
|
26
26
|
import '../../../internals/helpers/promise.js';
|
|
27
27
|
import '../prompts.js';
|
|
28
28
|
import '../../../template.js';
|
|
29
|
-
import '../../../chat-
|
|
29
|
+
import '../../../chat-BRuyDeKR.js';
|
|
30
30
|
import '../../../backend/constants.js';
|
|
31
31
|
import '../../../logger/logger.js';
|
|
32
32
|
import 'pino';
|
|
33
|
-
import '../../../base-
|
|
33
|
+
import '../../../base-CyFx7BRL.js';
|
|
@@ -46,12 +46,12 @@ declare const DeepThinkReActAgentSystemPrompt: PromptTemplate<zod.ZodObject<{
|
|
|
46
46
|
}, zod.ZodTypeAny, "passthrough">>, "many">;
|
|
47
47
|
createdAt: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
48
48
|
}, "strip", zod.ZodTypeAny, {
|
|
49
|
-
instructions: string;
|
|
50
49
|
tools: zod.objectOutputType<{
|
|
51
50
|
name: zod.ZodString;
|
|
52
51
|
description: zod.ZodString;
|
|
53
52
|
schema: zod.ZodString;
|
|
54
53
|
}, zod.ZodTypeAny, "passthrough">[];
|
|
54
|
+
instructions: string;
|
|
55
55
|
createdAt?: string | null | undefined;
|
|
56
56
|
}, {
|
|
57
57
|
tools: zod.objectInputType<{
|
|
@@ -46,12 +46,12 @@ declare const DeepThinkReActAgentSystemPrompt: PromptTemplate<zod.ZodObject<{
|
|
|
46
46
|
}, zod.ZodTypeAny, "passthrough">>, "many">;
|
|
47
47
|
createdAt: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
48
48
|
}, "strip", zod.ZodTypeAny, {
|
|
49
|
-
instructions: string;
|
|
50
49
|
tools: zod.objectOutputType<{
|
|
51
50
|
name: zod.ZodString;
|
|
52
51
|
description: zod.ZodString;
|
|
53
52
|
schema: zod.ZodString;
|
|
54
53
|
}, zod.ZodTypeAny, "passthrough">[];
|
|
54
|
+
instructions: string;
|
|
55
55
|
createdAt?: string | null | undefined;
|
|
56
56
|
}, {
|
|
57
57
|
tools: zod.objectInputType<{
|
|
@@ -4,10 +4,10 @@ import { PromptTemplate } from '../../../../template.cjs';
|
|
|
4
4
|
import { AnyTool } from '../../../../tools/base.cjs';
|
|
5
5
|
import { DefaultRunner } from '../default/runner.cjs';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import { R as ReActAgentInput, a as ReActAgent } from '../../../../agent-
|
|
7
|
+
import { R as ReActAgentInput, a as ReActAgent } from '../../../../agent-PRlGoawI.cjs';
|
|
8
8
|
import { GetRunContext } from '../../../../context.cjs';
|
|
9
9
|
import 'node_modules/remeda/dist/ToString-DKW-jYvM.js';
|
|
10
|
-
import '../../../../emitter-
|
|
10
|
+
import '../../../../emitter-jN55XZZq.cjs';
|
|
11
11
|
import '../../../../internals/types.cjs';
|
|
12
12
|
import '../../../../internals/helpers/guards.cjs';
|
|
13
13
|
import '../../../../internals/serializable.cjs';
|
|
@@ -21,7 +21,7 @@ import '../../../../backend/message.cjs';
|
|
|
21
21
|
import 'ai';
|
|
22
22
|
import '../../prompts.cjs';
|
|
23
23
|
import 'ajv';
|
|
24
|
-
import '../../../../chat-
|
|
24
|
+
import '../../../../chat-BFl85cqt.cjs';
|
|
25
25
|
import 'promise-based-task';
|
|
26
26
|
import '../../../../cache/base.cjs';
|
|
27
27
|
import '../../../../backend/constants.cjs';
|
|
@@ -30,7 +30,7 @@ import 'pino';
|
|
|
30
30
|
import '../../../../internals/helpers/promise.cjs';
|
|
31
31
|
import '../../../../internals/helpers/schema.cjs';
|
|
32
32
|
import 'zod-to-json-schema';
|
|
33
|
-
import '../../../../base-
|
|
33
|
+
import '../../../../base-XfWeXQ-S.cjs';
|
|
34
34
|
import '../../../../internals/helpers/counter.cjs';
|
|
35
35
|
|
|
36
36
|
declare class DeepThinkRunner extends DefaultRunner {
|
|
@@ -52,12 +52,12 @@ declare class DeepThinkRunner extends DefaultRunner {
|
|
|
52
52
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
53
53
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
54
|
}, "strip", z.ZodTypeAny, {
|
|
55
|
-
instructions: string;
|
|
56
55
|
tools: z.objectOutputType<{
|
|
57
56
|
name: z.ZodString;
|
|
58
57
|
description: z.ZodString;
|
|
59
58
|
schema: z.ZodString;
|
|
60
59
|
}, z.ZodTypeAny, "passthrough">[];
|
|
60
|
+
instructions: string;
|
|
61
61
|
createdAt?: string | null | undefined;
|
|
62
62
|
}, {
|
|
63
63
|
tools: z.objectInputType<{
|
|
@@ -4,10 +4,10 @@ import { PromptTemplate } from '../../../../template.js';
|
|
|
4
4
|
import { AnyTool } from '../../../../tools/base.js';
|
|
5
5
|
import { DefaultRunner } from '../default/runner.js';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import { R as ReActAgentInput, a as ReActAgent } from '../../../../agent-
|
|
7
|
+
import { R as ReActAgentInput, a as ReActAgent } from '../../../../agent-CZGWXO-X.js';
|
|
8
8
|
import { GetRunContext } from '../../../../context.js';
|
|
9
9
|
import 'node_modules/remeda/dist/ToString-DKW-jYvM.js';
|
|
10
|
-
import '../../../../emitter-
|
|
10
|
+
import '../../../../emitter-36-9MnvA.js';
|
|
11
11
|
import '../../../../internals/types.js';
|
|
12
12
|
import '../../../../internals/helpers/guards.js';
|
|
13
13
|
import '../../../../internals/serializable.js';
|
|
@@ -21,7 +21,7 @@ import '../../../../backend/message.js';
|
|
|
21
21
|
import 'ai';
|
|
22
22
|
import '../../prompts.js';
|
|
23
23
|
import 'ajv';
|
|
24
|
-
import '../../../../chat-
|
|
24
|
+
import '../../../../chat-BRuyDeKR.js';
|
|
25
25
|
import 'promise-based-task';
|
|
26
26
|
import '../../../../cache/base.js';
|
|
27
27
|
import '../../../../backend/constants.js';
|
|
@@ -30,7 +30,7 @@ import 'pino';
|
|
|
30
30
|
import '../../../../internals/helpers/promise.js';
|
|
31
31
|
import '../../../../internals/helpers/schema.js';
|
|
32
32
|
import 'zod-to-json-schema';
|
|
33
|
-
import '../../../../base-
|
|
33
|
+
import '../../../../base-CyFx7BRL.js';
|
|
34
34
|
import '../../../../internals/helpers/counter.js';
|
|
35
35
|
|
|
36
36
|
declare class DeepThinkRunner extends DefaultRunner {
|
|
@@ -52,12 +52,12 @@ declare class DeepThinkRunner extends DefaultRunner {
|
|
|
52
52
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
53
53
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
54
|
}, "strip", z.ZodTypeAny, {
|
|
55
|
-
instructions: string;
|
|
56
55
|
tools: z.objectOutputType<{
|
|
57
56
|
name: z.ZodString;
|
|
58
57
|
description: z.ZodString;
|
|
59
58
|
schema: z.ZodString;
|
|
60
59
|
}, z.ZodTypeAny, "passthrough">[];
|
|
60
|
+
instructions: string;
|
|
61
61
|
createdAt?: string | null | undefined;
|
|
62
62
|
}, {
|
|
63
63
|
tools: z.objectInputType<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PromptTemplate } from '../../../../template.cjs';
|
|
2
|
-
import { B as BaseRunner, b as ReActAgentRunnerLLMInput, c as ReActAgentRunnerToolInput } from '../../../../agent-
|
|
2
|
+
import { B as BaseRunner, b as ReActAgentRunnerLLMInput, c as ReActAgentRunnerToolInput } from '../../../../agent-PRlGoawI.cjs';
|
|
3
3
|
import { ReActAgentRunIteration, ReActAgentRunInput, ReActAgentParserInput } from '../../types.cjs';
|
|
4
4
|
import { AnyTool } from '../../../../tools/base.cjs';
|
|
5
5
|
import { LinePrefixParser } from '../../../../parsers/linePrefix.cjs';
|
|
@@ -12,10 +12,10 @@ import '../../../../internals/helpers/guards.cjs';
|
|
|
12
12
|
import '../../../../internals/serializable.cjs';
|
|
13
13
|
import 'ajv';
|
|
14
14
|
import '../../../../context.cjs';
|
|
15
|
-
import '../../../../emitter-
|
|
15
|
+
import '../../../../emitter-jN55XZZq.cjs';
|
|
16
16
|
import '../../../../internals/helpers/promise.cjs';
|
|
17
|
-
import '../../../../base-
|
|
18
|
-
import '../../../../chat-
|
|
17
|
+
import '../../../../base-XfWeXQ-S.cjs';
|
|
18
|
+
import '../../../../chat-BFl85cqt.cjs';
|
|
19
19
|
import 'promise-based-task';
|
|
20
20
|
import '../../../../cache/base.cjs';
|
|
21
21
|
import '../../../../backend/constants.cjs';
|
|
@@ -52,12 +52,12 @@ declare class DefaultRunner extends BaseRunner {
|
|
|
52
52
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
53
53
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
54
|
}, "strip", z.ZodTypeAny, {
|
|
55
|
-
instructions: string;
|
|
56
55
|
tools: z.objectOutputType<{
|
|
57
56
|
name: z.ZodString;
|
|
58
57
|
description: z.ZodString;
|
|
59
58
|
schema: z.ZodString;
|
|
60
59
|
}, z.ZodTypeAny, "passthrough">[];
|
|
60
|
+
instructions: string;
|
|
61
61
|
createdAt?: string | null | undefined;
|
|
62
62
|
}, {
|
|
63
63
|
tools: z.objectInputType<{
|