From 67fb80a879e461d7e16b9bc3e61dd5fef117e70f Mon Sep 17 00:00:00 2001 From: Ciaran Morinan Date: Mon, 16 Dec 2024 13:26:56 +0000 Subject: [PATCH] type fix, yarn deduplicate --- .../flow-activities/answer-question-action.ts | 15 +++++------- yarn.lock | 24 +------------------ 2 files changed, 7 insertions(+), 32 deletions(-) diff --git a/apps/hash-ai-worker-ts/src/activities/flow-activities/answer-question-action.ts b/apps/hash-ai-worker-ts/src/activities/flow-activities/answer-question-action.ts index 588f6191828..e0c9286d872 100644 --- a/apps/hash-ai-worker-ts/src/activities/flow-activities/answer-question-action.ts +++ b/apps/hash-ai-worker-ts/src/activities/flow-activities/answer-question-action.ts @@ -17,15 +17,9 @@ import { StatusCode } from "@local/status"; import { Context } from "@temporalio/activity"; import dedent from "dedent"; import { CodeInterpreter, Sandbox } from "e2b"; -import { OpenAI } from "openai"; +import type { OpenAI } from "openai"; import { logger } from "../shared/activity-logger.js"; -import type { PermittedOpenAiModel } from "../shared/openai-client.js"; -import { stringify } from "../shared/stringify.js"; -import type { FlowActionActivity } from "./types.js"; -import ChatCompletionUserMessageParam = OpenAI.ChatCompletionUserMessageParam; -import ChatCompletionToolMessageParam = OpenAI.ChatCompletionToolMessageParam; - import { getFlowContext } from "../shared/get-flow-context.js"; import { getLlmResponse } from "../shared/get-llm-response.js"; import { @@ -37,6 +31,9 @@ import type { LlmToolDefinition } from "../shared/get-llm-response/types.js"; import { graphApiClient } from "../shared/graph-api-client.js"; import { mapActionInputEntitiesToEntities } from "../shared/map-action-input-entities-to-entities.js"; import { openAiSeed } from "../shared/open-ai-seed.js"; +import type { PermittedOpenAiModel } from "../shared/openai-client.js"; +import { stringify } from "../shared/stringify.js"; +import type { FlowActionActivity } from "./types.js"; const answerTools: LlmToolDefinition[] = [ { @@ -202,7 +199,7 @@ const callModel = async ( const toolCalls = getToolCallsFromLlmAssistantMessage({ message }); - const responseMessages: ChatCompletionToolMessageParam[] = []; + const responseMessages: OpenAI.ChatCompletionToolMessageParam[] = []; /** * Defining these outside the loop so that in cases where the maximum iteration is reached, @@ -384,7 +381,7 @@ const callModel = async ( ); } - const responseMessage: ChatCompletionUserMessageParam = { + const responseMessage: OpenAI.ChatCompletionUserMessageParam = { role: "user", content: "You didn't make any valid tool calls as part of your response. Please review the tools available to you and use the appropriate one.", diff --git a/yarn.lock b/yarn.lock index 3a82dd19c51..ae96b6a5cbc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -37546,7 +37546,7 @@ __metadata: languageName: node linkType: hard -"openai@npm:4.76.2": +"openai@npm:4.76.2, openai@npm:^4.38.0": version: 4.76.2 resolution: "openai@npm:4.76.2" dependencies: @@ -37568,28 +37568,6 @@ __metadata: languageName: node linkType: hard -"openai@npm:^4.38.0": - version: 4.73.1 - resolution: "openai@npm:4.73.1" - dependencies: - "@types/node": "npm:^18.11.18" - "@types/node-fetch": "npm:^2.6.4" - abort-controller: "npm:^3.0.0" - agentkeepalive: "npm:^4.2.1" - form-data-encoder: "npm:1.7.2" - formdata-node: "npm:^4.3.2" - node-fetch: "npm:^2.6.7" - peerDependencies: - zod: ^3.23.8 - peerDependenciesMeta: - zod: - optional: true - bin: - openai: bin/cli - checksum: 10c0/556b5ba76846fb6d0bacff1b708ec009034cf92f107d84f1d7962625a0d74bf63e7cdfa48b10faf279d6a2c1d3aaf7c68a23b88aa61539a6ba6a9ef8dda7fd35 - languageName: node - linkType: hard - "openapi-sampler@npm:^1.5.0": version: 1.6.0 resolution: "openapi-sampler@npm:1.6.0"