From f12bc2fbde86b32a235583d82c0a4a983b2476a2 Mon Sep 17 00:00:00 2001 From: isamu Date: Fri, 10 May 2024 06:13:02 +0900 Subject: [PATCH] more type --- src/experimental_agents/llm_agents/groq_agent.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/experimental_agents/llm_agents/groq_agent.ts b/src/experimental_agents/llm_agents/groq_agent.ts index 65174360d..37f78ebe2 100644 --- a/src/experimental_agents/llm_agents/groq_agent.ts +++ b/src/experimental_agents/llm_agents/groq_agent.ts @@ -28,12 +28,12 @@ export const groqAgent: AgentFunction< query?: string; system?: string; verbose?: boolean; - tools?: Record; + tools?: Record; temperature?: number; max_tokens?: number; - tool_choice?: string | Record; + tool_choice?: string | Record; }, - Record | string, + Groq.Chat.ChatCompletion, string | Array > = async ({ params, inputs }) => { assert(groq !== undefined, "The GROQ_API_KEY environment variable is missing."); @@ -41,9 +41,9 @@ export const groqAgent: AgentFunction< const [input_query, previous_messages] = inputs; // Notice that we ignore params.system if previous_message exists. - const messages: Array = previous_messages && Array.isArray(previous_messages) ? previous_messages : system ? [{ role: "system", content: system }] : []; + const messages: Array = previous_messages && Array.isArray(previous_messages) ? previous_messages : system ? [{ role: "system", content: system }] : []; - const content = (query ? [query] : []).concat(input_query ? [input_query as string] : []).join("\n"); + const content = (query ? [query] : []).concat(input_query && typeof input_query === "string" ? [input_query] : []).join("\n"); if (content) { messages.push({ role: "user",