@langchain/openai 0.3.12 → 0.3.14
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/chat_models.cjs +0 -10
- package/dist/chat_models.d.ts +3 -3
- package/dist/chat_models.js +1 -11
- package/package.json +1 -1
package/dist/chat_models.cjs
CHANGED
|
@@ -1211,16 +1211,6 @@ class ChatOpenAI extends chat_models_1.BaseChatModel {
|
|
|
1211
1211
|
};
|
|
1212
1212
|
}
|
|
1213
1213
|
async *_streamResponseChunks(messages, options, runManager) {
|
|
1214
|
-
if (this.model.includes("o1-")) {
|
|
1215
|
-
console.warn("[WARNING]: OpenAI o1 models do not yet support token-level streaming. Streaming will yield single chunk.");
|
|
1216
|
-
const result = await this._generate(messages, options, runManager);
|
|
1217
|
-
const messageChunk = (0, messages_1.convertToChunk)(result.generations[0].message);
|
|
1218
|
-
yield new outputs_1.ChatGenerationChunk({
|
|
1219
|
-
message: messageChunk,
|
|
1220
|
-
text: typeof messageChunk.content === "string" ? messageChunk.content : "",
|
|
1221
|
-
});
|
|
1222
|
-
return;
|
|
1223
|
-
}
|
|
1224
1214
|
const messagesMapped = _convertMessagesToOpenAIParams(messages);
|
|
1225
1215
|
const params = {
|
|
1226
1216
|
...this.invocationParams(options, {
|
package/dist/chat_models.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
|
|
|
3
3
|
import { AIMessageChunk, type BaseMessage } from "@langchain/core/messages";
|
|
4
4
|
import { ChatGenerationChunk, type ChatResult } from "@langchain/core/outputs";
|
|
5
5
|
import { BaseChatModel, BindToolsInput, LangSmithParams, type BaseChatModelParams } from "@langchain/core/language_models/chat_models";
|
|
6
|
-
import { type BaseFunctionCallOptions, type BaseLanguageModelInput, type StructuredOutputMethodOptions
|
|
6
|
+
import { type BaseFunctionCallOptions, type BaseLanguageModelInput, type StructuredOutputMethodOptions } from "@langchain/core/language_models/base";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { Runnable } from "@langchain/core/runnables";
|
|
9
9
|
import type { AzureOpenAIInput, OpenAICallOptions, OpenAIChatInput, OpenAICoreRequestOptions, LegacyOpenAIInput, ChatOpenAIResponseFormat } from "./types.js";
|
|
@@ -744,8 +744,8 @@ export declare class ChatOpenAI<CallOptions extends ChatOpenAICallOptions = Chat
|
|
|
744
744
|
_llmType(): string;
|
|
745
745
|
/** @ignore */
|
|
746
746
|
_combineLLMOutput(...llmOutputs: OpenAILLMOutput[]): OpenAILLMOutput;
|
|
747
|
-
withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema:
|
|
748
|
-
withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema:
|
|
747
|
+
withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: z.ZodType<RunOutput> | Record<string, any>, config?: ChatOpenAIStructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
748
|
+
withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: z.ZodType<RunOutput> | Record<string, any>, config?: ChatOpenAIStructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
749
749
|
raw: BaseMessage;
|
|
750
750
|
parsed: RunOutput;
|
|
751
751
|
}>;
|
package/dist/chat_models.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OpenAI as OpenAIClient } from "openai";
|
|
2
|
-
import { AIMessage, AIMessageChunk, ChatMessage, ChatMessageChunk, FunctionMessageChunk, HumanMessageChunk, SystemMessageChunk, ToolMessageChunk, isAIMessage,
|
|
2
|
+
import { AIMessage, AIMessageChunk, ChatMessage, ChatMessageChunk, FunctionMessageChunk, HumanMessageChunk, SystemMessageChunk, ToolMessageChunk, isAIMessage, } from "@langchain/core/messages";
|
|
3
3
|
import { ChatGenerationChunk, } from "@langchain/core/outputs";
|
|
4
4
|
import { getEnvironmentVariable } from "@langchain/core/utils/env";
|
|
5
5
|
import { BaseChatModel, } from "@langchain/core/language_models/chat_models";
|
|
@@ -1206,16 +1206,6 @@ export class ChatOpenAI extends BaseChatModel {
|
|
|
1206
1206
|
};
|
|
1207
1207
|
}
|
|
1208
1208
|
async *_streamResponseChunks(messages, options, runManager) {
|
|
1209
|
-
if (this.model.includes("o1-")) {
|
|
1210
|
-
console.warn("[WARNING]: OpenAI o1 models do not yet support token-level streaming. Streaming will yield single chunk.");
|
|
1211
|
-
const result = await this._generate(messages, options, runManager);
|
|
1212
|
-
const messageChunk = convertToChunk(result.generations[0].message);
|
|
1213
|
-
yield new ChatGenerationChunk({
|
|
1214
|
-
message: messageChunk,
|
|
1215
|
-
text: typeof messageChunk.content === "string" ? messageChunk.content : "",
|
|
1216
|
-
});
|
|
1217
|
-
return;
|
|
1218
|
-
}
|
|
1219
1209
|
const messagesMapped = _convertMessagesToOpenAIParams(messages);
|
|
1220
1210
|
const params = {
|
|
1221
1211
|
...this.invocationParams(options, {
|