Skip to content

Commit

Permalink
Update npm package openai to v4.76.2 (#5601)
Browse files Browse the repository at this point in the history
Co-authored-by: hash-worker[bot] <180894564+hash-worker[bot]@users.noreply.github.com>
Co-authored-by: Ciaran Morinan <[email protected]>
Co-authored-by: Ciaran Morinan <[email protected]>
  • Loading branch information
3 people authored Dec 16, 2024
1 parent 63bdf40 commit b3d70b9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 40 deletions.
2 changes: 1 addition & 1 deletion apps/hash-ai-worker-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"md5": "2.3.0",
"mime-types": "2.1.35",
"officeparser": "4.2.0",
"openai": "4.68.4",
"openai": "4.76.2",
"openai-chat-tokens": "0.2.8",
"papaparse": "5.4.1",
"pdf2json": "3.1.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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[] = [
{
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.",
Expand Down
3 changes: 2 additions & 1 deletion apps/hash-ai-worker-ts/src/activities/shared/embeddings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import type {
} from "@local/hash-graph-types/ontology";
import { extractBaseUrl } from "@local/hash-subgraph/type-system-patch";
import OpenAI from "openai";
import Usage = OpenAI.CreateEmbeddingResponse.Usage;

type Usage = OpenAI.CreateEmbeddingResponse.Usage;

const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
Expand Down
2 changes: 1 addition & 1 deletion apps/hash-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"nanoid": "3.3.8",
"nodemailer": "6.9.16",
"oembed-providers": "1.0.20241022",
"openai": "4.68.4",
"openai": "4.76.2",
"ts-json-schema-generator": "1.5.1",
"tsx": "4.19.2",
"typescript": "5.6.3",
Expand Down
34 changes: 6 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ __metadata:
md5: "npm:2.3.0"
mime-types: "npm:2.1.35"
officeparser: "npm:4.2.0"
openai: "npm:4.68.4"
openai: "npm:4.76.2"
openai-chat-tokens: "npm:0.2.8"
papaparse: "npm:5.4.1"
pdf2json: "npm:3.1.4"
Expand Down Expand Up @@ -444,7 +444,7 @@ __metadata:
nanoid: "npm:3.3.8"
nodemailer: "npm:6.9.16"
oembed-providers: "npm:1.0.20241022"
openai: "npm:4.68.4"
openai: "npm:4.76.2"
prettier: "npm:3.4.2"
rimraf: "npm:6.0.1"
ts-json-schema-generator: "npm:1.5.1"
Expand Down Expand Up @@ -37544,9 +37544,9 @@ __metadata:
languageName: node
linkType: hard

"openai@npm:4.68.4":
version: 4.68.4
resolution: "openai@npm:4.68.4"
"openai@npm:4.76.2, openai@npm:^4.38.0":
version: 4.76.2
resolution: "openai@npm:4.76.2"
dependencies:
"@types/node": "npm:^18.11.18"
"@types/node-fetch": "npm:^2.6.4"
Expand All @@ -37562,29 +37562,7 @@ __metadata:
optional: true
bin:
openai: bin/cli
checksum: 10c0/4f81795d0847ad145815299fc4f6448f084f9db43ede651776ca636d4907ff9a07de9379b9feea5e54a2d96e95ee9bcc74c3284e13376bf80684be74e0041479
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
checksum: 10c0/d78af0c2dd64ad24a2ce92deb92656b742b8120012e554fd562095f237ce06d84764217e040b437f955c6f26b7675f9321862a8937c8537f28ed6ead4b674559
languageName: node
linkType: hard

Expand Down

0 comments on commit b3d70b9

Please sign in to comment.