@langchain/openai 1.0.0-alpha.3 → 1.1.0
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/CHANGELOG.md +53 -0
- package/dist/azure/chat_models/common.cjs +130 -0
- package/dist/azure/chat_models/common.cjs.map +1 -0
- package/dist/azure/chat_models/common.d.cts +16 -0
- package/dist/azure/chat_models/common.d.cts.map +1 -0
- package/dist/azure/chat_models/common.d.ts +16 -0
- package/dist/azure/chat_models/common.d.ts.map +1 -0
- package/dist/azure/chat_models/common.js +124 -0
- package/dist/azure/chat_models/common.js.map +1 -0
- package/dist/azure/chat_models/completions.cjs +50 -0
- package/dist/azure/chat_models/completions.cjs.map +1 -0
- package/dist/azure/chat_models/completions.d.cts +29 -0
- package/dist/azure/chat_models/completions.d.cts.map +1 -0
- package/dist/azure/chat_models/completions.d.ts +29 -0
- package/dist/azure/chat_models/completions.d.ts.map +1 -0
- package/dist/azure/chat_models/completions.js +50 -0
- package/dist/azure/chat_models/completions.js.map +1 -0
- package/dist/azure/{chat_models.cjs → chat_models/index.cjs} +14 -214
- package/dist/azure/chat_models/index.cjs.map +1 -0
- package/dist/azure/{chat_models.d.ts → chat_models/index.d.cts} +6 -11
- package/dist/azure/chat_models/index.d.cts.map +1 -0
- package/dist/azure/{chat_models.d.cts → chat_models/index.d.ts} +6 -11
- package/dist/azure/chat_models/index.d.ts.map +1 -0
- package/dist/azure/{chat_models.js → chat_models/index.js} +6 -205
- package/dist/azure/chat_models/index.js.map +1 -0
- package/dist/azure/chat_models/responses.cjs +50 -0
- package/dist/azure/chat_models/responses.cjs.map +1 -0
- package/dist/azure/chat_models/responses.d.cts +29 -0
- package/dist/azure/chat_models/responses.d.cts.map +1 -0
- package/dist/azure/chat_models/responses.d.ts +29 -0
- package/dist/azure/chat_models/responses.d.ts.map +1 -0
- package/dist/azure/chat_models/responses.js +50 -0
- package/dist/azure/chat_models/responses.js.map +1 -0
- package/dist/chat_models/base.cjs +533 -0
- package/dist/chat_models/base.cjs.map +1 -0
- package/dist/chat_models/base.d.cts +272 -0
- package/dist/chat_models/base.d.cts.map +1 -0
- package/dist/chat_models/base.d.ts +272 -0
- package/dist/chat_models/base.d.ts.map +1 -0
- package/dist/chat_models/base.js +532 -0
- package/dist/chat_models/base.js.map +1 -0
- package/dist/chat_models/completions.cjs +258 -0
- package/dist/chat_models/completions.cjs.map +1 -0
- package/dist/chat_models/completions.d.cts +44 -0
- package/dist/chat_models/completions.d.cts.map +1 -0
- package/dist/chat_models/completions.d.ts +44 -0
- package/dist/chat_models/completions.d.ts.map +1 -0
- package/dist/chat_models/completions.js +257 -0
- package/dist/chat_models/completions.js.map +1 -0
- package/dist/chat_models/index.cjs +608 -0
- package/dist/chat_models/index.cjs.map +1 -0
- package/dist/chat_models/index.d.cts +593 -0
- package/dist/chat_models/index.d.cts.map +1 -0
- package/dist/chat_models/index.d.ts +593 -0
- package/dist/chat_models/index.d.ts.map +1 -0
- package/dist/chat_models/index.js +608 -0
- package/dist/chat_models/index.js.map +1 -0
- package/dist/chat_models/responses.cjs +189 -0
- package/dist/chat_models/responses.cjs.map +1 -0
- package/dist/chat_models/responses.d.cts +62 -0
- package/dist/chat_models/responses.d.cts.map +1 -0
- package/dist/chat_models/responses.d.ts +62 -0
- package/dist/chat_models/responses.d.ts.map +1 -0
- package/dist/chat_models/responses.js +188 -0
- package/dist/chat_models/responses.js.map +1 -0
- package/dist/converters/completions.cjs +603 -0
- package/dist/converters/completions.cjs.map +1 -0
- package/dist/converters/completions.js +599 -0
- package/dist/converters/completions.js.map +1 -0
- package/dist/converters/responses.cjs +892 -0
- package/dist/converters/responses.cjs.map +1 -0
- package/dist/converters/responses.js +889 -0
- package/dist/converters/responses.js.map +1 -0
- package/dist/index.cjs +14 -9
- package/dist/index.d.cts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +8 -4
- package/dist/langchain-core/dist/callbacks/base.d.ts +1 -0
- package/dist/langchain-core/dist/callbacks/manager.d.ts +2 -0
- package/dist/langchain-core/dist/language_models/base.d.ts +5 -0
- package/dist/langchain-core/dist/language_models/chat_models.d.cts +13 -0
- package/dist/langchain-core/dist/language_models/chat_models.d.cts.map +1 -0
- package/dist/langchain-core/dist/language_models/chat_models.d.ts +20 -0
- package/dist/langchain-core/dist/language_models/chat_models.d.ts.map +1 -0
- package/dist/langchain-core/dist/runnables/base.d.ts +7 -0
- package/dist/langchain-core/dist/runnables/graph.d.ts +1 -0
- package/dist/langchain-core/dist/runnables/types.d.ts +2 -0
- package/dist/langchain-core/dist/tools/types.d.ts +5 -0
- package/dist/langchain-core/dist/tracers/base.d.ts +2 -0
- package/dist/langchain-core/dist/tracers/event_stream.d.ts +1 -0
- package/dist/langchain-core/dist/tracers/log_stream.d.ts +3 -0
- package/dist/langchain-core/dist/utils/types/index.d.ts +1 -0
- package/dist/langchain-core/dist/utils/types/zod.d.ts +1 -0
- package/dist/llms.cjs +1 -1
- package/dist/llms.d.cts +1 -1
- package/dist/llms.js +1 -1
- package/dist/utils/errors.cjs +1 -1
- package/dist/utils/errors.cjs.map +1 -1
- package/dist/utils/errors.js +1 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/misc.js +2 -2
- package/dist/utils/misc.js.map +1 -1
- package/dist/utils/output.cjs +0 -12
- package/dist/utils/output.cjs.map +1 -1
- package/dist/utils/output.js +1 -12
- package/dist/utils/output.js.map +1 -1
- package/dist/utils/prompts.cjs +2 -2
- package/dist/utils/prompts.cjs.map +1 -1
- package/dist/utils/prompts.d.cts +1 -0
- package/dist/utils/prompts.d.cts.map +1 -1
- package/dist/utils/prompts.d.ts +1 -0
- package/dist/utils/prompts.d.ts.map +1 -1
- package/dist/utils/prompts.js +2 -2
- package/dist/utils/prompts.js.map +1 -1
- package/package.json +10 -7
- package/dist/azure/chat_models.cjs.map +0 -1
- package/dist/azure/chat_models.d.cts.map +0 -1
- package/dist/azure/chat_models.d.ts.map +0 -1
- package/dist/azure/chat_models.js.map +0 -1
- package/dist/chat_models.cjs +0 -1967
- package/dist/chat_models.cjs.map +0 -1
- package/dist/chat_models.d.cts +0 -933
- package/dist/chat_models.d.cts.map +0 -1
- package/dist/chat_models.d.ts +0 -933
- package/dist/chat_models.d.ts.map +0 -1
- package/dist/chat_models.js +0 -1963
- package/dist/chat_models.js.map +0 -1
- package/dist/utils/message_inputs.cjs +0 -139
- package/dist/utils/message_inputs.cjs.map +0 -1
- package/dist/utils/message_inputs.d.cts +0 -9
- package/dist/utils/message_inputs.d.cts.map +0 -1
- package/dist/utils/message_inputs.d.ts +0 -9
- package/dist/utils/message_inputs.d.ts.map +0 -1
- package/dist/utils/message_inputs.js +0 -137
- package/dist/utils/message_inputs.js.map +0 -1
- package/dist/utils/standard.cjs +0 -315
- package/dist/utils/standard.cjs.map +0 -1
- package/dist/utils/standard.js +0 -313
- package/dist/utils/standard.js.map +0 -1
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { IterableReadableStream } from "../langchain-core/dist/utils/stream.cjs";
|
|
2
|
+
import { ChatOpenAIResponseFormat, OpenAICallOptions, OpenAIChatInput, OpenAICoreRequestOptions, OpenAIVerbosityParam, ResponseFormatConfiguration } from "../types.cjs";
|
|
3
|
+
import { ChatOpenAIToolType, OpenAIToolChoice, ResponsesToolChoice } from "../utils/tools.cjs";
|
|
4
|
+
import { ClientOptions, OpenAI as OpenAI$1 } from "openai";
|
|
5
|
+
import * as _langchain_core_messages0 from "@langchain/core/messages";
|
|
6
|
+
import { AIMessageChunk, BaseMessage } from "@langchain/core/messages";
|
|
7
|
+
import { ChatGeneration } from "@langchain/core/outputs";
|
|
8
|
+
import { BaseChatModel, BaseChatModelCallOptions, BaseChatModelParams, LangSmithParams } from "@langchain/core/language_models/chat_models";
|
|
9
|
+
import { BaseFunctionCallOptions, BaseLanguageModelInput, StructuredOutputMethodOptions } from "@langchain/core/language_models/base";
|
|
10
|
+
import { Runnable } from "@langchain/core/runnables";
|
|
11
|
+
import { InteropZodType } from "@langchain/core/utils/types";
|
|
12
|
+
|
|
13
|
+
//#region src/chat_models/base.d.ts
|
|
14
|
+
interface OpenAILLMOutput {
|
|
15
|
+
tokenUsage: {
|
|
16
|
+
completionTokens?: number;
|
|
17
|
+
promptTokens?: number;
|
|
18
|
+
totalTokens?: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface BaseChatOpenAICallOptions extends BaseChatModelCallOptions, BaseFunctionCallOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Additional options to pass to the underlying axios request.
|
|
24
|
+
*/
|
|
25
|
+
options?: OpenAICoreRequestOptions;
|
|
26
|
+
/**
|
|
27
|
+
* A list of tools that the model may use to generate responses.
|
|
28
|
+
* Each tool can be a function, a built-in tool, or a custom tool definition.
|
|
29
|
+
* If not provided, the model will not use any tools.
|
|
30
|
+
*/
|
|
31
|
+
tools?: ChatOpenAIToolType[];
|
|
32
|
+
/**
|
|
33
|
+
* Specifies which tool the model should use to respond.
|
|
34
|
+
* Can be an {@link OpenAIToolChoice} or a {@link ResponsesToolChoice}.
|
|
35
|
+
* If not set, the model will decide which tool to use automatically.
|
|
36
|
+
*/
|
|
37
|
+
// TODO: break OpenAIToolChoice and ResponsesToolChoice into options sub classes
|
|
38
|
+
tool_choice?: OpenAIToolChoice | ResponsesToolChoice;
|
|
39
|
+
/**
|
|
40
|
+
* Adds a prompt index to prompts passed to the model to track
|
|
41
|
+
* what prompt is being used for a given generation.
|
|
42
|
+
*/
|
|
43
|
+
promptIndex?: number;
|
|
44
|
+
/**
|
|
45
|
+
* An object specifying the format that the model must output.
|
|
46
|
+
*/
|
|
47
|
+
response_format?: ChatOpenAIResponseFormat;
|
|
48
|
+
/**
|
|
49
|
+
* When provided, the completions API will make a best effort to sample
|
|
50
|
+
* deterministically, such that repeated requests with the same `seed`
|
|
51
|
+
* and parameters should return the same result.
|
|
52
|
+
*/
|
|
53
|
+
seed?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Additional options to pass to streamed completions.
|
|
56
|
+
* If provided, this takes precedence over "streamUsage" set at
|
|
57
|
+
* initialization time.
|
|
58
|
+
*/
|
|
59
|
+
stream_options?: OpenAI$1.Chat.ChatCompletionStreamOptions;
|
|
60
|
+
/**
|
|
61
|
+
* The model may choose to call multiple functions in a single turn. You can
|
|
62
|
+
* set parallel_tool_calls to false which ensures only one tool is called at most.
|
|
63
|
+
* [Learn more](https://platform.openai.com/docs/guides/function-calling#parallel-function-calling)
|
|
64
|
+
*/
|
|
65
|
+
parallel_tool_calls?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* If `true`, model output is guaranteed to exactly match the JSON Schema
|
|
68
|
+
* provided in the tool definition. If `true`, the input schema will also be
|
|
69
|
+
* validated according to
|
|
70
|
+
* https://platform.openai.com/docs/guides/structured-outputs/supported-schemas.
|
|
71
|
+
*
|
|
72
|
+
* If `false`, input schema will not be validated and model output will not
|
|
73
|
+
* be validated.
|
|
74
|
+
*
|
|
75
|
+
* If `undefined`, `strict` argument will not be passed to the model.
|
|
76
|
+
*/
|
|
77
|
+
strict?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Output types that you would like the model to generate for this request. Most
|
|
80
|
+
* models are capable of generating text, which is the default:
|
|
81
|
+
*
|
|
82
|
+
* `["text"]`
|
|
83
|
+
*
|
|
84
|
+
* The `gpt-4o-audio-preview` model can also be used to
|
|
85
|
+
* [generate audio](https://platform.openai.com/docs/guides/audio). To request that
|
|
86
|
+
* this model generate both text and audio responses, you can use:
|
|
87
|
+
*
|
|
88
|
+
* `["text", "audio"]`
|
|
89
|
+
*/
|
|
90
|
+
modalities?: Array<OpenAI$1.Chat.ChatCompletionModality>;
|
|
91
|
+
/**
|
|
92
|
+
* Parameters for audio output. Required when audio output is requested with
|
|
93
|
+
* `modalities: ["audio"]`.
|
|
94
|
+
* [Learn more](https://platform.openai.com/docs/guides/audio).
|
|
95
|
+
*/
|
|
96
|
+
audio?: OpenAI$1.Chat.ChatCompletionAudioParam;
|
|
97
|
+
/**
|
|
98
|
+
* Static predicted output content, such as the content of a text file that is being regenerated.
|
|
99
|
+
* [Learn more](https://platform.openai.com/docs/guides/latency-optimization#use-predicted-outputs).
|
|
100
|
+
*/
|
|
101
|
+
prediction?: OpenAI$1.ChatCompletionPredictionContent;
|
|
102
|
+
/**
|
|
103
|
+
* Options for reasoning models.
|
|
104
|
+
*
|
|
105
|
+
* Note that some options, like reasoning summaries, are only available when using the responses
|
|
106
|
+
* API. If these options are set, the responses API will be used to fulfill the request.
|
|
107
|
+
*
|
|
108
|
+
* These options will be ignored when not using a reasoning model.
|
|
109
|
+
*/
|
|
110
|
+
reasoning?: OpenAI$1.Reasoning;
|
|
111
|
+
/**
|
|
112
|
+
* Service tier to use for this request. Can be "auto", "default", or "flex"
|
|
113
|
+
* Specifies the service tier for prioritization and latency optimization.
|
|
114
|
+
*/
|
|
115
|
+
service_tier?: OpenAI$1.Chat.ChatCompletionCreateParams["service_tier"];
|
|
116
|
+
/**
|
|
117
|
+
* Used by OpenAI to cache responses for similar requests to optimize your cache
|
|
118
|
+
* hit rates. Replaces the `user` field.
|
|
119
|
+
* [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
|
|
120
|
+
*/
|
|
121
|
+
promptCacheKey?: string;
|
|
122
|
+
/**
|
|
123
|
+
* The verbosity of the model's response.
|
|
124
|
+
*/
|
|
125
|
+
verbosity?: OpenAIVerbosityParam;
|
|
126
|
+
}
|
|
127
|
+
interface BaseChatOpenAIFields extends Partial<OpenAIChatInput>, BaseChatModelParams {
|
|
128
|
+
/**
|
|
129
|
+
* Optional configuration options for the OpenAI client.
|
|
130
|
+
*/
|
|
131
|
+
configuration?: ClientOptions;
|
|
132
|
+
}
|
|
133
|
+
/** @internal */
|
|
134
|
+
declare abstract class BaseChatOpenAI<CallOptions extends BaseChatOpenAICallOptions> extends BaseChatModel<CallOptions, AIMessageChunk> implements Partial<OpenAIChatInput> {
|
|
135
|
+
temperature?: number;
|
|
136
|
+
topP?: number;
|
|
137
|
+
frequencyPenalty?: number;
|
|
138
|
+
presencePenalty?: number;
|
|
139
|
+
n?: number;
|
|
140
|
+
logitBias?: Record<string, number>;
|
|
141
|
+
model: string;
|
|
142
|
+
modelKwargs?: OpenAIChatInput["modelKwargs"];
|
|
143
|
+
stop?: string[];
|
|
144
|
+
stopSequences?: string[];
|
|
145
|
+
user?: string;
|
|
146
|
+
timeout?: number;
|
|
147
|
+
streaming: boolean;
|
|
148
|
+
streamUsage: boolean;
|
|
149
|
+
maxTokens?: number;
|
|
150
|
+
logprobs?: boolean;
|
|
151
|
+
topLogprobs?: number;
|
|
152
|
+
apiKey?: string;
|
|
153
|
+
organization?: string;
|
|
154
|
+
__includeRawResponse?: boolean;
|
|
155
|
+
/** @internal */
|
|
156
|
+
client: OpenAI$1;
|
|
157
|
+
/** @internal */
|
|
158
|
+
clientConfig: ClientOptions;
|
|
159
|
+
/**
|
|
160
|
+
* Whether the model supports the `strict` argument when passing in tools.
|
|
161
|
+
* If `undefined` the `strict` argument will not be passed to OpenAI.
|
|
162
|
+
*/
|
|
163
|
+
supportsStrictToolCalling?: boolean;
|
|
164
|
+
audio?: OpenAI$1.Chat.ChatCompletionAudioParam;
|
|
165
|
+
modalities?: Array<OpenAI$1.Chat.ChatCompletionModality>;
|
|
166
|
+
reasoning?: OpenAI$1.Reasoning;
|
|
167
|
+
/**
|
|
168
|
+
* Must be set to `true` in tenancies with Zero Data Retention. Setting to `true` will disable
|
|
169
|
+
* output storage in the Responses API, but this DOES NOT enable Zero Data Retention in your
|
|
170
|
+
* OpenAI organization or project. This must be configured directly with OpenAI.
|
|
171
|
+
*
|
|
172
|
+
* See:
|
|
173
|
+
* https://platform.openai.com/docs/guides/your-data
|
|
174
|
+
* https://platform.openai.com/docs/api-reference/responses/create#responses-create-store
|
|
175
|
+
*
|
|
176
|
+
* @default false
|
|
177
|
+
*/
|
|
178
|
+
zdrEnabled?: boolean | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* Service tier to use for this request. Can be "auto", "default", or "flex" or "priority".
|
|
181
|
+
* Specifies the service tier for prioritization and latency optimization.
|
|
182
|
+
*/
|
|
183
|
+
service_tier?: OpenAI$1.Chat.ChatCompletionCreateParams["service_tier"];
|
|
184
|
+
/**
|
|
185
|
+
* Used by OpenAI to cache responses for similar requests to optimize your cache
|
|
186
|
+
* hit rates.
|
|
187
|
+
* [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
|
|
188
|
+
*/
|
|
189
|
+
promptCacheKey: string;
|
|
190
|
+
/**
|
|
191
|
+
* The verbosity of the model's response.
|
|
192
|
+
*/
|
|
193
|
+
verbosity?: OpenAIVerbosityParam;
|
|
194
|
+
protected defaultOptions: CallOptions;
|
|
195
|
+
_llmType(): string;
|
|
196
|
+
static lc_name(): string;
|
|
197
|
+
get callKeys(): string[];
|
|
198
|
+
lc_serializable: boolean;
|
|
199
|
+
get lc_secrets(): {
|
|
200
|
+
[key: string]: string;
|
|
201
|
+
} | undefined;
|
|
202
|
+
get lc_aliases(): Record<string, string>;
|
|
203
|
+
get lc_serializable_keys(): string[];
|
|
204
|
+
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams;
|
|
205
|
+
/** @ignore */
|
|
206
|
+
_identifyingParams(): Omit<OpenAI$1.Chat.ChatCompletionCreateParams, "messages"> & {
|
|
207
|
+
model_name: string;
|
|
208
|
+
} & ClientOptions;
|
|
209
|
+
/**
|
|
210
|
+
* Get the identifying parameters for the model
|
|
211
|
+
*/
|
|
212
|
+
identifyingParams(): Omit<OpenAI$1.ChatCompletionCreateParams, "messages"> & {
|
|
213
|
+
model_name: string;
|
|
214
|
+
} & ClientOptions;
|
|
215
|
+
constructor(fields?: BaseChatOpenAIFields);
|
|
216
|
+
/**
|
|
217
|
+
* Returns backwards compatible reasoning parameters from constructor params and call options
|
|
218
|
+
* @internal
|
|
219
|
+
*/
|
|
220
|
+
protected _getReasoningParams(options?: this["ParsedCallOptions"]): OpenAI$1.Reasoning | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* Returns an openai compatible response format from a set of options
|
|
223
|
+
* @internal
|
|
224
|
+
*/
|
|
225
|
+
protected _getResponseFormat(resFormat?: CallOptions["response_format"]): ResponseFormatConfiguration | undefined;
|
|
226
|
+
protected _combineCallOptions(additionalOptions?: this["ParsedCallOptions"]): this["ParsedCallOptions"];
|
|
227
|
+
/** @internal */
|
|
228
|
+
_getClientOptions(options: OpenAICoreRequestOptions | undefined): OpenAICoreRequestOptions;
|
|
229
|
+
// TODO: move to completions class
|
|
230
|
+
protected _convertChatOpenAIToolToCompletionsTool(tool: ChatOpenAIToolType, fields?: {
|
|
231
|
+
strict?: boolean;
|
|
232
|
+
}): OpenAI$1.ChatCompletionTool;
|
|
233
|
+
bindTools(tools: ChatOpenAIToolType[], kwargs?: Partial<CallOptions>): Runnable<BaseLanguageModelInput, AIMessageChunk, CallOptions>;
|
|
234
|
+
stream(input: BaseLanguageModelInput, options?: CallOptions): Promise<IterableReadableStream<AIMessageChunk<_langchain_core_messages0.MessageStructure>>>;
|
|
235
|
+
invoke(input: BaseLanguageModelInput, options?: CallOptions): Promise<AIMessageChunk<_langchain_core_messages0.MessageStructure>>;
|
|
236
|
+
/** @ignore */
|
|
237
|
+
_combineLLMOutput(...llmOutputs: OpenAILLMOutput[]): OpenAILLMOutput;
|
|
238
|
+
getNumTokensFromMessages(messages: BaseMessage[]): Promise<{
|
|
239
|
+
totalCount: number;
|
|
240
|
+
countPerMessage: number[];
|
|
241
|
+
}>;
|
|
242
|
+
/** @internal */
|
|
243
|
+
protected _getNumTokensFromGenerations(generations: ChatGeneration[]): Promise<number>;
|
|
244
|
+
/** @internal */
|
|
245
|
+
protected _getEstimatedTokenCountFromPrompt(messages: BaseMessage[], functions?: OpenAI$1.Chat.ChatCompletionCreateParams.Function[], function_call?: "none" | "auto" | OpenAI$1.Chat.ChatCompletionFunctionCallOption): Promise<number>;
|
|
246
|
+
/** @internal */
|
|
247
|
+
protected _getStructuredOutputMethod(config: StructuredOutputMethodOptions<boolean>): string | undefined;
|
|
248
|
+
withStructuredOutput<
|
|
249
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
250
|
+
RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>
|
|
251
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
252
|
+
| Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
253
|
+
withStructuredOutput<
|
|
254
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
255
|
+
RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>
|
|
256
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
257
|
+
| Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
258
|
+
raw: BaseMessage;
|
|
259
|
+
parsed: RunOutput;
|
|
260
|
+
}>;
|
|
261
|
+
withStructuredOutput<
|
|
262
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
263
|
+
RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>
|
|
264
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
265
|
+
| Record<string, any>, config?: StructuredOutputMethodOptions<boolean>): Runnable<BaseLanguageModelInput, RunOutput> | Runnable<BaseLanguageModelInput, {
|
|
266
|
+
raw: BaseMessage;
|
|
267
|
+
parsed: RunOutput;
|
|
268
|
+
}>;
|
|
269
|
+
}
|
|
270
|
+
//#endregion
|
|
271
|
+
export { BaseChatOpenAI, BaseChatOpenAICallOptions, BaseChatOpenAIFields };
|
|
272
|
+
//# sourceMappingURL=base.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.cts","names":["____________langchain_core_dist_utils_stream_js0","ClientOptions","OpenAI","OpenAIClient","AIMessageChunk","BaseMessage","ChatGeneration","BaseChatModel","LangSmithParams","BaseChatModelParams","BaseChatModelCallOptions","BaseFunctionCallOptions","BaseLanguageModelInput","StructuredOutputMethodOptions","Runnable","InteropZodType","OpenAICallOptions","OpenAIChatInput","OpenAICoreRequestOptions","ChatOpenAIResponseFormat","ResponseFormatConfiguration","OpenAIVerbosityParam","OpenAIToolChoice","ChatOpenAIToolType","ResponsesToolChoice","OpenAILLMOutput","BaseChatOpenAICallOptions","Chat","ChatCompletionStreamOptions","ChatCompletionModality","Array","ChatCompletionAudioParam","ChatCompletionPredictionContent","Reasoning","ChatCompletionCreateParams","BaseChatOpenAIFields","Partial","BaseChatOpenAI","CallOptions","Record","Omit","ChatCompletionTool","_langchain_core_messages0","MessageStructure","IterableReadableStream","Promise","Function","ChatCompletionFunctionCallOption","RunOutput"],"sources":["../../src/chat_models/base.d.ts"],"sourcesContent":["import { type ClientOptions, OpenAI as OpenAIClient } from \"openai\";\nimport { AIMessageChunk, type BaseMessage } from \"@langchain/core/messages\";\nimport { type ChatGeneration } from \"@langchain/core/outputs\";\nimport { BaseChatModel, type LangSmithParams, type BaseChatModelParams, BaseChatModelCallOptions } from \"@langchain/core/language_models/chat_models\";\nimport { type BaseFunctionCallOptions, type BaseLanguageModelInput, type StructuredOutputMethodOptions } from \"@langchain/core/language_models/base\";\nimport { Runnable } from \"@langchain/core/runnables\";\nimport { InteropZodType } from \"@langchain/core/utils/types\";\nimport { type OpenAICallOptions, type OpenAIChatInput, type OpenAICoreRequestOptions, type ChatOpenAIResponseFormat, ResponseFormatConfiguration, OpenAIVerbosityParam } from \"../types.js\";\nimport { OpenAIToolChoice, ChatOpenAIToolType, ResponsesToolChoice } from \"../utils/tools.js\";\ninterface OpenAILLMOutput {\n tokenUsage: {\n completionTokens?: number;\n promptTokens?: number;\n totalTokens?: number;\n };\n}\nexport type { OpenAICallOptions, OpenAIChatInput };\nexport interface BaseChatOpenAICallOptions extends BaseChatModelCallOptions, BaseFunctionCallOptions {\n /**\n * Additional options to pass to the underlying axios request.\n */\n options?: OpenAICoreRequestOptions;\n /**\n * A list of tools that the model may use to generate responses.\n * Each tool can be a function, a built-in tool, or a custom tool definition.\n * If not provided, the model will not use any tools.\n */\n tools?: ChatOpenAIToolType[];\n /**\n * Specifies which tool the model should use to respond.\n * Can be an {@link OpenAIToolChoice} or a {@link ResponsesToolChoice}.\n * If not set, the model will decide which tool to use automatically.\n */\n // TODO: break OpenAIToolChoice and ResponsesToolChoice into options sub classes\n tool_choice?: OpenAIToolChoice | ResponsesToolChoice;\n /**\n * Adds a prompt index to prompts passed to the model to track\n * what prompt is being used for a given generation.\n */\n promptIndex?: number;\n /**\n * An object specifying the format that the model must output.\n */\n response_format?: ChatOpenAIResponseFormat;\n /**\n * When provided, the completions API will make a best effort to sample\n * deterministically, such that repeated requests with the same `seed`\n * and parameters should return the same result.\n */\n seed?: number;\n /**\n * Additional options to pass to streamed completions.\n * If provided, this takes precedence over \"streamUsage\" set at\n * initialization time.\n */\n stream_options?: OpenAIClient.Chat.ChatCompletionStreamOptions;\n /**\n * The model may choose to call multiple functions in a single turn. You can\n * set parallel_tool_calls to false which ensures only one tool is called at most.\n * [Learn more](https://platform.openai.com/docs/guides/function-calling#parallel-function-calling)\n */\n parallel_tool_calls?: boolean;\n /**\n * If `true`, model output is guaranteed to exactly match the JSON Schema\n * provided in the tool definition. If `true`, the input schema will also be\n * validated according to\n * https://platform.openai.com/docs/guides/structured-outputs/supported-schemas.\n *\n * If `false`, input schema will not be validated and model output will not\n * be validated.\n *\n * If `undefined`, `strict` argument will not be passed to the model.\n */\n strict?: boolean;\n /**\n * Output types that you would like the model to generate for this request. Most\n * models are capable of generating text, which is the default:\n *\n * `[\"text\"]`\n *\n * The `gpt-4o-audio-preview` model can also be used to\n * [generate audio](https://platform.openai.com/docs/guides/audio). To request that\n * this model generate both text and audio responses, you can use:\n *\n * `[\"text\", \"audio\"]`\n */\n modalities?: Array<OpenAIClient.Chat.ChatCompletionModality>;\n /**\n * Parameters for audio output. Required when audio output is requested with\n * `modalities: [\"audio\"]`.\n * [Learn more](https://platform.openai.com/docs/guides/audio).\n */\n audio?: OpenAIClient.Chat.ChatCompletionAudioParam;\n /**\n * Static predicted output content, such as the content of a text file that is being regenerated.\n * [Learn more](https://platform.openai.com/docs/guides/latency-optimization#use-predicted-outputs).\n */\n prediction?: OpenAIClient.ChatCompletionPredictionContent;\n /**\n * Options for reasoning models.\n *\n * Note that some options, like reasoning summaries, are only available when using the responses\n * API. If these options are set, the responses API will be used to fulfill the request.\n *\n * These options will be ignored when not using a reasoning model.\n */\n reasoning?: OpenAIClient.Reasoning;\n /**\n * Service tier to use for this request. Can be \"auto\", \"default\", or \"flex\"\n * Specifies the service tier for prioritization and latency optimization.\n */\n service_tier?: OpenAIClient.Chat.ChatCompletionCreateParams[\"service_tier\"];\n /**\n * Used by OpenAI to cache responses for similar requests to optimize your cache\n * hit rates. Replaces the `user` field.\n * [Learn more](https://platform.openai.com/docs/guides/prompt-caching).\n */\n promptCacheKey?: string;\n /**\n * The verbosity of the model's response.\n */\n verbosity?: OpenAIVerbosityParam;\n}\nexport interface BaseChatOpenAIFields extends Partial<OpenAIChatInput>, BaseChatModelParams {\n /**\n * Optional configuration options for the OpenAI client.\n */\n configuration?: ClientOptions;\n}\n/** @internal */\nexport declare abstract class BaseChatOpenAI<CallOptions extends BaseChatOpenAICallOptions> extends BaseChatModel<CallOptions, AIMessageChunk> implements Partial<OpenAIChatInput> {\n temperature?: number;\n topP?: number;\n frequencyPenalty?: number;\n presencePenalty?: number;\n n?: number;\n logitBias?: Record<string, number>;\n model: string;\n modelKwargs?: OpenAIChatInput[\"modelKwargs\"];\n stop?: string[];\n stopSequences?: string[];\n user?: string;\n timeout?: number;\n streaming: boolean;\n streamUsage: boolean;\n maxTokens?: number;\n logprobs?: boolean;\n topLogprobs?: number;\n apiKey?: string;\n organization?: string;\n __includeRawResponse?: boolean;\n /** @internal */\n client: OpenAIClient;\n /** @internal */\n clientConfig: ClientOptions;\n /**\n * Whether the model supports the `strict` argument when passing in tools.\n * If `undefined` the `strict` argument will not be passed to OpenAI.\n */\n supportsStrictToolCalling?: boolean;\n audio?: OpenAIClient.Chat.ChatCompletionAudioParam;\n modalities?: Array<OpenAIClient.Chat.ChatCompletionModality>;\n reasoning?: OpenAIClient.Reasoning;\n /**\n * Must be set to `true` in tenancies with Zero Data Retention. Setting to `true` will disable\n * output storage in the Responses API, but this DOES NOT enable Zero Data Retention in your\n * OpenAI organization or project. This must be configured directly with OpenAI.\n *\n * See:\n * https://platform.openai.com/docs/guides/your-data\n * https://platform.openai.com/docs/api-reference/responses/create#responses-create-store\n *\n * @default false\n */\n zdrEnabled?: boolean | undefined;\n /**\n * Service tier to use for this request. Can be \"auto\", \"default\", or \"flex\" or \"priority\".\n * Specifies the service tier for prioritization and latency optimization.\n */\n service_tier?: OpenAIClient.Chat.ChatCompletionCreateParams[\"service_tier\"];\n /**\n * Used by OpenAI to cache responses for similar requests to optimize your cache\n * hit rates.\n * [Learn more](https://platform.openai.com/docs/guides/prompt-caching).\n */\n promptCacheKey: string;\n /**\n * The verbosity of the model's response.\n */\n verbosity?: OpenAIVerbosityParam;\n protected defaultOptions: CallOptions;\n _llmType(): string;\n static lc_name(): string;\n get callKeys(): string[];\n lc_serializable: boolean;\n get lc_secrets(): {\n [key: string]: string;\n } | undefined;\n get lc_aliases(): Record<string, string>;\n get lc_serializable_keys(): string[];\n getLsParams(options: this[\"ParsedCallOptions\"]): LangSmithParams;\n /** @ignore */\n _identifyingParams(): Omit<OpenAIClient.Chat.ChatCompletionCreateParams, \"messages\"> & {\n model_name: string;\n } & ClientOptions;\n /**\n * Get the identifying parameters for the model\n */\n identifyingParams(): Omit<OpenAIClient.ChatCompletionCreateParams, \"messages\"> & {\n model_name: string;\n } & ClientOptions;\n constructor(fields?: BaseChatOpenAIFields);\n /**\n * Returns backwards compatible reasoning parameters from constructor params and call options\n * @internal\n */\n protected _getReasoningParams(options?: this[\"ParsedCallOptions\"]): OpenAIClient.Reasoning | undefined;\n /**\n * Returns an openai compatible response format from a set of options\n * @internal\n */\n protected _getResponseFormat(resFormat?: CallOptions[\"response_format\"]): ResponseFormatConfiguration | undefined;\n protected _combineCallOptions(additionalOptions?: this[\"ParsedCallOptions\"]): this[\"ParsedCallOptions\"];\n /** @internal */\n _getClientOptions(options: OpenAICoreRequestOptions | undefined): OpenAICoreRequestOptions;\n // TODO: move to completions class\n protected _convertChatOpenAIToolToCompletionsTool(tool: ChatOpenAIToolType, fields?: {\n strict?: boolean;\n }): OpenAIClient.ChatCompletionTool;\n bindTools(tools: ChatOpenAIToolType[], kwargs?: Partial<CallOptions>): Runnable<BaseLanguageModelInput, AIMessageChunk, CallOptions>;\n stream(input: BaseLanguageModelInput, options?: CallOptions): Promise<import(\"../../../../langchain-core/dist/utils/stream.js\").IterableReadableStream<AIMessageChunk<import(\"@langchain/core/messages\").MessageStructure>>>;\n invoke(input: BaseLanguageModelInput, options?: CallOptions): Promise<AIMessageChunk<import(\"@langchain/core/messages\").MessageStructure>>;\n /** @ignore */\n _combineLLMOutput(...llmOutputs: OpenAILLMOutput[]): OpenAILLMOutput;\n getNumTokensFromMessages(messages: BaseMessage[]): Promise<{\n totalCount: number;\n countPerMessage: number[];\n }>;\n /** @internal */\n protected _getNumTokensFromGenerations(generations: ChatGeneration[]): Promise<number>;\n /** @internal */\n protected _getEstimatedTokenCountFromPrompt(messages: BaseMessage[], functions?: OpenAIClient.Chat.ChatCompletionCreateParams.Function[], function_call?: \"none\" | \"auto\" | OpenAIClient.Chat.ChatCompletionFunctionCallOption): Promise<number>;\n /** @internal */\n protected _getStructuredOutputMethod(config: StructuredOutputMethodOptions<boolean>): string | undefined;\n withStructuredOutput<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;\n withStructuredOutput<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {\n raw: BaseMessage;\n parsed: RunOutput;\n }>;\n withStructuredOutput<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Record<string, any>, config?: StructuredOutputMethodOptions<boolean>): Runnable<BaseLanguageModelInput, RunOutput> | Runnable<BaseLanguageModelInput, {\n raw: BaseMessage;\n parsed: RunOutput;\n }>;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { IterableReadableStream } from "../langchain-core/dist/utils/stream.js";
|
|
2
|
+
import { ChatOpenAIResponseFormat, OpenAICallOptions, OpenAIChatInput, OpenAICoreRequestOptions, OpenAIVerbosityParam, ResponseFormatConfiguration } from "../types.js";
|
|
3
|
+
import { ChatOpenAIToolType, OpenAIToolChoice, ResponsesToolChoice } from "../utils/tools.js";
|
|
4
|
+
import { ClientOptions, OpenAI as OpenAI$1 } from "openai";
|
|
5
|
+
import { BaseChatModel, BaseChatModelCallOptions, BaseChatModelParams, LangSmithParams } from "@langchain/core/language_models/chat_models";
|
|
6
|
+
import { BaseFunctionCallOptions, BaseLanguageModelInput, StructuredOutputMethodOptions } from "@langchain/core/language_models/base";
|
|
7
|
+
import { Runnable } from "@langchain/core/runnables";
|
|
8
|
+
import { InteropZodType } from "@langchain/core/utils/types";
|
|
9
|
+
import * as _langchain_core_messages0 from "@langchain/core/messages";
|
|
10
|
+
import { AIMessageChunk, BaseMessage } from "@langchain/core/messages";
|
|
11
|
+
import { ChatGeneration } from "@langchain/core/outputs";
|
|
12
|
+
|
|
13
|
+
//#region src/chat_models/base.d.ts
|
|
14
|
+
interface OpenAILLMOutput {
|
|
15
|
+
tokenUsage: {
|
|
16
|
+
completionTokens?: number;
|
|
17
|
+
promptTokens?: number;
|
|
18
|
+
totalTokens?: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface BaseChatOpenAICallOptions extends BaseChatModelCallOptions, BaseFunctionCallOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Additional options to pass to the underlying axios request.
|
|
24
|
+
*/
|
|
25
|
+
options?: OpenAICoreRequestOptions;
|
|
26
|
+
/**
|
|
27
|
+
* A list of tools that the model may use to generate responses.
|
|
28
|
+
* Each tool can be a function, a built-in tool, or a custom tool definition.
|
|
29
|
+
* If not provided, the model will not use any tools.
|
|
30
|
+
*/
|
|
31
|
+
tools?: ChatOpenAIToolType[];
|
|
32
|
+
/**
|
|
33
|
+
* Specifies which tool the model should use to respond.
|
|
34
|
+
* Can be an {@link OpenAIToolChoice} or a {@link ResponsesToolChoice}.
|
|
35
|
+
* If not set, the model will decide which tool to use automatically.
|
|
36
|
+
*/
|
|
37
|
+
// TODO: break OpenAIToolChoice and ResponsesToolChoice into options sub classes
|
|
38
|
+
tool_choice?: OpenAIToolChoice | ResponsesToolChoice;
|
|
39
|
+
/**
|
|
40
|
+
* Adds a prompt index to prompts passed to the model to track
|
|
41
|
+
* what prompt is being used for a given generation.
|
|
42
|
+
*/
|
|
43
|
+
promptIndex?: number;
|
|
44
|
+
/**
|
|
45
|
+
* An object specifying the format that the model must output.
|
|
46
|
+
*/
|
|
47
|
+
response_format?: ChatOpenAIResponseFormat;
|
|
48
|
+
/**
|
|
49
|
+
* When provided, the completions API will make a best effort to sample
|
|
50
|
+
* deterministically, such that repeated requests with the same `seed`
|
|
51
|
+
* and parameters should return the same result.
|
|
52
|
+
*/
|
|
53
|
+
seed?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Additional options to pass to streamed completions.
|
|
56
|
+
* If provided, this takes precedence over "streamUsage" set at
|
|
57
|
+
* initialization time.
|
|
58
|
+
*/
|
|
59
|
+
stream_options?: OpenAI$1.Chat.ChatCompletionStreamOptions;
|
|
60
|
+
/**
|
|
61
|
+
* The model may choose to call multiple functions in a single turn. You can
|
|
62
|
+
* set parallel_tool_calls to false which ensures only one tool is called at most.
|
|
63
|
+
* [Learn more](https://platform.openai.com/docs/guides/function-calling#parallel-function-calling)
|
|
64
|
+
*/
|
|
65
|
+
parallel_tool_calls?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* If `true`, model output is guaranteed to exactly match the JSON Schema
|
|
68
|
+
* provided in the tool definition. If `true`, the input schema will also be
|
|
69
|
+
* validated according to
|
|
70
|
+
* https://platform.openai.com/docs/guides/structured-outputs/supported-schemas.
|
|
71
|
+
*
|
|
72
|
+
* If `false`, input schema will not be validated and model output will not
|
|
73
|
+
* be validated.
|
|
74
|
+
*
|
|
75
|
+
* If `undefined`, `strict` argument will not be passed to the model.
|
|
76
|
+
*/
|
|
77
|
+
strict?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Output types that you would like the model to generate for this request. Most
|
|
80
|
+
* models are capable of generating text, which is the default:
|
|
81
|
+
*
|
|
82
|
+
* `["text"]`
|
|
83
|
+
*
|
|
84
|
+
* The `gpt-4o-audio-preview` model can also be used to
|
|
85
|
+
* [generate audio](https://platform.openai.com/docs/guides/audio). To request that
|
|
86
|
+
* this model generate both text and audio responses, you can use:
|
|
87
|
+
*
|
|
88
|
+
* `["text", "audio"]`
|
|
89
|
+
*/
|
|
90
|
+
modalities?: Array<OpenAI$1.Chat.ChatCompletionModality>;
|
|
91
|
+
/**
|
|
92
|
+
* Parameters for audio output. Required when audio output is requested with
|
|
93
|
+
* `modalities: ["audio"]`.
|
|
94
|
+
* [Learn more](https://platform.openai.com/docs/guides/audio).
|
|
95
|
+
*/
|
|
96
|
+
audio?: OpenAI$1.Chat.ChatCompletionAudioParam;
|
|
97
|
+
/**
|
|
98
|
+
* Static predicted output content, such as the content of a text file that is being regenerated.
|
|
99
|
+
* [Learn more](https://platform.openai.com/docs/guides/latency-optimization#use-predicted-outputs).
|
|
100
|
+
*/
|
|
101
|
+
prediction?: OpenAI$1.ChatCompletionPredictionContent;
|
|
102
|
+
/**
|
|
103
|
+
* Options for reasoning models.
|
|
104
|
+
*
|
|
105
|
+
* Note that some options, like reasoning summaries, are only available when using the responses
|
|
106
|
+
* API. If these options are set, the responses API will be used to fulfill the request.
|
|
107
|
+
*
|
|
108
|
+
* These options will be ignored when not using a reasoning model.
|
|
109
|
+
*/
|
|
110
|
+
reasoning?: OpenAI$1.Reasoning;
|
|
111
|
+
/**
|
|
112
|
+
* Service tier to use for this request. Can be "auto", "default", or "flex"
|
|
113
|
+
* Specifies the service tier for prioritization and latency optimization.
|
|
114
|
+
*/
|
|
115
|
+
service_tier?: OpenAI$1.Chat.ChatCompletionCreateParams["service_tier"];
|
|
116
|
+
/**
|
|
117
|
+
* Used by OpenAI to cache responses for similar requests to optimize your cache
|
|
118
|
+
* hit rates. Replaces the `user` field.
|
|
119
|
+
* [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
|
|
120
|
+
*/
|
|
121
|
+
promptCacheKey?: string;
|
|
122
|
+
/**
|
|
123
|
+
* The verbosity of the model's response.
|
|
124
|
+
*/
|
|
125
|
+
verbosity?: OpenAIVerbosityParam;
|
|
126
|
+
}
|
|
127
|
+
interface BaseChatOpenAIFields extends Partial<OpenAIChatInput>, BaseChatModelParams {
|
|
128
|
+
/**
|
|
129
|
+
* Optional configuration options for the OpenAI client.
|
|
130
|
+
*/
|
|
131
|
+
configuration?: ClientOptions;
|
|
132
|
+
}
|
|
133
|
+
/** @internal */
|
|
134
|
+
declare abstract class BaseChatOpenAI<CallOptions extends BaseChatOpenAICallOptions> extends BaseChatModel<CallOptions, AIMessageChunk> implements Partial<OpenAIChatInput> {
|
|
135
|
+
temperature?: number;
|
|
136
|
+
topP?: number;
|
|
137
|
+
frequencyPenalty?: number;
|
|
138
|
+
presencePenalty?: number;
|
|
139
|
+
n?: number;
|
|
140
|
+
logitBias?: Record<string, number>;
|
|
141
|
+
model: string;
|
|
142
|
+
modelKwargs?: OpenAIChatInput["modelKwargs"];
|
|
143
|
+
stop?: string[];
|
|
144
|
+
stopSequences?: string[];
|
|
145
|
+
user?: string;
|
|
146
|
+
timeout?: number;
|
|
147
|
+
streaming: boolean;
|
|
148
|
+
streamUsage: boolean;
|
|
149
|
+
maxTokens?: number;
|
|
150
|
+
logprobs?: boolean;
|
|
151
|
+
topLogprobs?: number;
|
|
152
|
+
apiKey?: string;
|
|
153
|
+
organization?: string;
|
|
154
|
+
__includeRawResponse?: boolean;
|
|
155
|
+
/** @internal */
|
|
156
|
+
client: OpenAI$1;
|
|
157
|
+
/** @internal */
|
|
158
|
+
clientConfig: ClientOptions;
|
|
159
|
+
/**
|
|
160
|
+
* Whether the model supports the `strict` argument when passing in tools.
|
|
161
|
+
* If `undefined` the `strict` argument will not be passed to OpenAI.
|
|
162
|
+
*/
|
|
163
|
+
supportsStrictToolCalling?: boolean;
|
|
164
|
+
audio?: OpenAI$1.Chat.ChatCompletionAudioParam;
|
|
165
|
+
modalities?: Array<OpenAI$1.Chat.ChatCompletionModality>;
|
|
166
|
+
reasoning?: OpenAI$1.Reasoning;
|
|
167
|
+
/**
|
|
168
|
+
* Must be set to `true` in tenancies with Zero Data Retention. Setting to `true` will disable
|
|
169
|
+
* output storage in the Responses API, but this DOES NOT enable Zero Data Retention in your
|
|
170
|
+
* OpenAI organization or project. This must be configured directly with OpenAI.
|
|
171
|
+
*
|
|
172
|
+
* See:
|
|
173
|
+
* https://platform.openai.com/docs/guides/your-data
|
|
174
|
+
* https://platform.openai.com/docs/api-reference/responses/create#responses-create-store
|
|
175
|
+
*
|
|
176
|
+
* @default false
|
|
177
|
+
*/
|
|
178
|
+
zdrEnabled?: boolean | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* Service tier to use for this request. Can be "auto", "default", or "flex" or "priority".
|
|
181
|
+
* Specifies the service tier for prioritization and latency optimization.
|
|
182
|
+
*/
|
|
183
|
+
service_tier?: OpenAI$1.Chat.ChatCompletionCreateParams["service_tier"];
|
|
184
|
+
/**
|
|
185
|
+
* Used by OpenAI to cache responses for similar requests to optimize your cache
|
|
186
|
+
* hit rates.
|
|
187
|
+
* [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
|
|
188
|
+
*/
|
|
189
|
+
promptCacheKey: string;
|
|
190
|
+
/**
|
|
191
|
+
* The verbosity of the model's response.
|
|
192
|
+
*/
|
|
193
|
+
verbosity?: OpenAIVerbosityParam;
|
|
194
|
+
protected defaultOptions: CallOptions;
|
|
195
|
+
_llmType(): string;
|
|
196
|
+
static lc_name(): string;
|
|
197
|
+
get callKeys(): string[];
|
|
198
|
+
lc_serializable: boolean;
|
|
199
|
+
get lc_secrets(): {
|
|
200
|
+
[key: string]: string;
|
|
201
|
+
} | undefined;
|
|
202
|
+
get lc_aliases(): Record<string, string>;
|
|
203
|
+
get lc_serializable_keys(): string[];
|
|
204
|
+
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams;
|
|
205
|
+
/** @ignore */
|
|
206
|
+
_identifyingParams(): Omit<OpenAI$1.Chat.ChatCompletionCreateParams, "messages"> & {
|
|
207
|
+
model_name: string;
|
|
208
|
+
} & ClientOptions;
|
|
209
|
+
/**
|
|
210
|
+
* Get the identifying parameters for the model
|
|
211
|
+
*/
|
|
212
|
+
identifyingParams(): Omit<OpenAI$1.ChatCompletionCreateParams, "messages"> & {
|
|
213
|
+
model_name: string;
|
|
214
|
+
} & ClientOptions;
|
|
215
|
+
constructor(fields?: BaseChatOpenAIFields);
|
|
216
|
+
/**
|
|
217
|
+
* Returns backwards compatible reasoning parameters from constructor params and call options
|
|
218
|
+
* @internal
|
|
219
|
+
*/
|
|
220
|
+
protected _getReasoningParams(options?: this["ParsedCallOptions"]): OpenAI$1.Reasoning | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* Returns an openai compatible response format from a set of options
|
|
223
|
+
* @internal
|
|
224
|
+
*/
|
|
225
|
+
protected _getResponseFormat(resFormat?: CallOptions["response_format"]): ResponseFormatConfiguration | undefined;
|
|
226
|
+
protected _combineCallOptions(additionalOptions?: this["ParsedCallOptions"]): this["ParsedCallOptions"];
|
|
227
|
+
/** @internal */
|
|
228
|
+
_getClientOptions(options: OpenAICoreRequestOptions | undefined): OpenAICoreRequestOptions;
|
|
229
|
+
// TODO: move to completions class
|
|
230
|
+
protected _convertChatOpenAIToolToCompletionsTool(tool: ChatOpenAIToolType, fields?: {
|
|
231
|
+
strict?: boolean;
|
|
232
|
+
}): OpenAI$1.ChatCompletionTool;
|
|
233
|
+
bindTools(tools: ChatOpenAIToolType[], kwargs?: Partial<CallOptions>): Runnable<BaseLanguageModelInput, AIMessageChunk, CallOptions>;
|
|
234
|
+
stream(input: BaseLanguageModelInput, options?: CallOptions): Promise<IterableReadableStream<AIMessageChunk<_langchain_core_messages0.MessageStructure>>>;
|
|
235
|
+
invoke(input: BaseLanguageModelInput, options?: CallOptions): Promise<AIMessageChunk<_langchain_core_messages0.MessageStructure>>;
|
|
236
|
+
/** @ignore */
|
|
237
|
+
_combineLLMOutput(...llmOutputs: OpenAILLMOutput[]): OpenAILLMOutput;
|
|
238
|
+
getNumTokensFromMessages(messages: BaseMessage[]): Promise<{
|
|
239
|
+
totalCount: number;
|
|
240
|
+
countPerMessage: number[];
|
|
241
|
+
}>;
|
|
242
|
+
/** @internal */
|
|
243
|
+
protected _getNumTokensFromGenerations(generations: ChatGeneration[]): Promise<number>;
|
|
244
|
+
/** @internal */
|
|
245
|
+
protected _getEstimatedTokenCountFromPrompt(messages: BaseMessage[], functions?: OpenAI$1.Chat.ChatCompletionCreateParams.Function[], function_call?: "none" | "auto" | OpenAI$1.Chat.ChatCompletionFunctionCallOption): Promise<number>;
|
|
246
|
+
/** @internal */
|
|
247
|
+
protected _getStructuredOutputMethod(config: StructuredOutputMethodOptions<boolean>): string | undefined;
|
|
248
|
+
withStructuredOutput<
|
|
249
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
250
|
+
RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>
|
|
251
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
252
|
+
| Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
253
|
+
withStructuredOutput<
|
|
254
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
255
|
+
RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>
|
|
256
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
257
|
+
| Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
258
|
+
raw: BaseMessage;
|
|
259
|
+
parsed: RunOutput;
|
|
260
|
+
}>;
|
|
261
|
+
withStructuredOutput<
|
|
262
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
263
|
+
RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>
|
|
264
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
265
|
+
| Record<string, any>, config?: StructuredOutputMethodOptions<boolean>): Runnable<BaseLanguageModelInput, RunOutput> | Runnable<BaseLanguageModelInput, {
|
|
266
|
+
raw: BaseMessage;
|
|
267
|
+
parsed: RunOutput;
|
|
268
|
+
}>;
|
|
269
|
+
}
|
|
270
|
+
//#endregion
|
|
271
|
+
export { BaseChatOpenAI, BaseChatOpenAICallOptions, BaseChatOpenAIFields };
|
|
272
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","names":["____________langchain_core_dist_utils_stream_js0","ClientOptions","OpenAI","OpenAIClient","AIMessageChunk","BaseMessage","ChatGeneration","BaseChatModel","LangSmithParams","BaseChatModelParams","BaseChatModelCallOptions","BaseFunctionCallOptions","BaseLanguageModelInput","StructuredOutputMethodOptions","Runnable","InteropZodType","OpenAICallOptions","OpenAIChatInput","OpenAICoreRequestOptions","ChatOpenAIResponseFormat","ResponseFormatConfiguration","OpenAIVerbosityParam","OpenAIToolChoice","ChatOpenAIToolType","ResponsesToolChoice","OpenAILLMOutput","BaseChatOpenAICallOptions","Chat","ChatCompletionStreamOptions","ChatCompletionModality","Array","ChatCompletionAudioParam","ChatCompletionPredictionContent","Reasoning","ChatCompletionCreateParams","BaseChatOpenAIFields","Partial","BaseChatOpenAI","CallOptions","Record","Omit","ChatCompletionTool","_langchain_core_messages0","MessageStructure","IterableReadableStream","Promise","Function","ChatCompletionFunctionCallOption","RunOutput"],"sources":["../../src/chat_models/base.d.ts"],"sourcesContent":["import { type ClientOptions, OpenAI as OpenAIClient } from \"openai\";\nimport { AIMessageChunk, type BaseMessage } from \"@langchain/core/messages\";\nimport { type ChatGeneration } from \"@langchain/core/outputs\";\nimport { BaseChatModel, type LangSmithParams, type BaseChatModelParams, BaseChatModelCallOptions } from \"@langchain/core/language_models/chat_models\";\nimport { type BaseFunctionCallOptions, type BaseLanguageModelInput, type StructuredOutputMethodOptions } from \"@langchain/core/language_models/base\";\nimport { Runnable } from \"@langchain/core/runnables\";\nimport { InteropZodType } from \"@langchain/core/utils/types\";\nimport { type OpenAICallOptions, type OpenAIChatInput, type OpenAICoreRequestOptions, type ChatOpenAIResponseFormat, ResponseFormatConfiguration, OpenAIVerbosityParam } from \"../types.js\";\nimport { OpenAIToolChoice, ChatOpenAIToolType, ResponsesToolChoice } from \"../utils/tools.js\";\ninterface OpenAILLMOutput {\n tokenUsage: {\n completionTokens?: number;\n promptTokens?: number;\n totalTokens?: number;\n };\n}\nexport type { OpenAICallOptions, OpenAIChatInput };\nexport interface BaseChatOpenAICallOptions extends BaseChatModelCallOptions, BaseFunctionCallOptions {\n /**\n * Additional options to pass to the underlying axios request.\n */\n options?: OpenAICoreRequestOptions;\n /**\n * A list of tools that the model may use to generate responses.\n * Each tool can be a function, a built-in tool, or a custom tool definition.\n * If not provided, the model will not use any tools.\n */\n tools?: ChatOpenAIToolType[];\n /**\n * Specifies which tool the model should use to respond.\n * Can be an {@link OpenAIToolChoice} or a {@link ResponsesToolChoice}.\n * If not set, the model will decide which tool to use automatically.\n */\n // TODO: break OpenAIToolChoice and ResponsesToolChoice into options sub classes\n tool_choice?: OpenAIToolChoice | ResponsesToolChoice;\n /**\n * Adds a prompt index to prompts passed to the model to track\n * what prompt is being used for a given generation.\n */\n promptIndex?: number;\n /**\n * An object specifying the format that the model must output.\n */\n response_format?: ChatOpenAIResponseFormat;\n /**\n * When provided, the completions API will make a best effort to sample\n * deterministically, such that repeated requests with the same `seed`\n * and parameters should return the same result.\n */\n seed?: number;\n /**\n * Additional options to pass to streamed completions.\n * If provided, this takes precedence over \"streamUsage\" set at\n * initialization time.\n */\n stream_options?: OpenAIClient.Chat.ChatCompletionStreamOptions;\n /**\n * The model may choose to call multiple functions in a single turn. You can\n * set parallel_tool_calls to false which ensures only one tool is called at most.\n * [Learn more](https://platform.openai.com/docs/guides/function-calling#parallel-function-calling)\n */\n parallel_tool_calls?: boolean;\n /**\n * If `true`, model output is guaranteed to exactly match the JSON Schema\n * provided in the tool definition. If `true`, the input schema will also be\n * validated according to\n * https://platform.openai.com/docs/guides/structured-outputs/supported-schemas.\n *\n * If `false`, input schema will not be validated and model output will not\n * be validated.\n *\n * If `undefined`, `strict` argument will not be passed to the model.\n */\n strict?: boolean;\n /**\n * Output types that you would like the model to generate for this request. Most\n * models are capable of generating text, which is the default:\n *\n * `[\"text\"]`\n *\n * The `gpt-4o-audio-preview` model can also be used to\n * [generate audio](https://platform.openai.com/docs/guides/audio). To request that\n * this model generate both text and audio responses, you can use:\n *\n * `[\"text\", \"audio\"]`\n */\n modalities?: Array<OpenAIClient.Chat.ChatCompletionModality>;\n /**\n * Parameters for audio output. Required when audio output is requested with\n * `modalities: [\"audio\"]`.\n * [Learn more](https://platform.openai.com/docs/guides/audio).\n */\n audio?: OpenAIClient.Chat.ChatCompletionAudioParam;\n /**\n * Static predicted output content, such as the content of a text file that is being regenerated.\n * [Learn more](https://platform.openai.com/docs/guides/latency-optimization#use-predicted-outputs).\n */\n prediction?: OpenAIClient.ChatCompletionPredictionContent;\n /**\n * Options for reasoning models.\n *\n * Note that some options, like reasoning summaries, are only available when using the responses\n * API. If these options are set, the responses API will be used to fulfill the request.\n *\n * These options will be ignored when not using a reasoning model.\n */\n reasoning?: OpenAIClient.Reasoning;\n /**\n * Service tier to use for this request. Can be \"auto\", \"default\", or \"flex\"\n * Specifies the service tier for prioritization and latency optimization.\n */\n service_tier?: OpenAIClient.Chat.ChatCompletionCreateParams[\"service_tier\"];\n /**\n * Used by OpenAI to cache responses for similar requests to optimize your cache\n * hit rates. Replaces the `user` field.\n * [Learn more](https://platform.openai.com/docs/guides/prompt-caching).\n */\n promptCacheKey?: string;\n /**\n * The verbosity of the model's response.\n */\n verbosity?: OpenAIVerbosityParam;\n}\nexport interface BaseChatOpenAIFields extends Partial<OpenAIChatInput>, BaseChatModelParams {\n /**\n * Optional configuration options for the OpenAI client.\n */\n configuration?: ClientOptions;\n}\n/** @internal */\nexport declare abstract class BaseChatOpenAI<CallOptions extends BaseChatOpenAICallOptions> extends BaseChatModel<CallOptions, AIMessageChunk> implements Partial<OpenAIChatInput> {\n temperature?: number;\n topP?: number;\n frequencyPenalty?: number;\n presencePenalty?: number;\n n?: number;\n logitBias?: Record<string, number>;\n model: string;\n modelKwargs?: OpenAIChatInput[\"modelKwargs\"];\n stop?: string[];\n stopSequences?: string[];\n user?: string;\n timeout?: number;\n streaming: boolean;\n streamUsage: boolean;\n maxTokens?: number;\n logprobs?: boolean;\n topLogprobs?: number;\n apiKey?: string;\n organization?: string;\n __includeRawResponse?: boolean;\n /** @internal */\n client: OpenAIClient;\n /** @internal */\n clientConfig: ClientOptions;\n /**\n * Whether the model supports the `strict` argument when passing in tools.\n * If `undefined` the `strict` argument will not be passed to OpenAI.\n */\n supportsStrictToolCalling?: boolean;\n audio?: OpenAIClient.Chat.ChatCompletionAudioParam;\n modalities?: Array<OpenAIClient.Chat.ChatCompletionModality>;\n reasoning?: OpenAIClient.Reasoning;\n /**\n * Must be set to `true` in tenancies with Zero Data Retention. Setting to `true` will disable\n * output storage in the Responses API, but this DOES NOT enable Zero Data Retention in your\n * OpenAI organization or project. This must be configured directly with OpenAI.\n *\n * See:\n * https://platform.openai.com/docs/guides/your-data\n * https://platform.openai.com/docs/api-reference/responses/create#responses-create-store\n *\n * @default false\n */\n zdrEnabled?: boolean | undefined;\n /**\n * Service tier to use for this request. Can be \"auto\", \"default\", or \"flex\" or \"priority\".\n * Specifies the service tier for prioritization and latency optimization.\n */\n service_tier?: OpenAIClient.Chat.ChatCompletionCreateParams[\"service_tier\"];\n /**\n * Used by OpenAI to cache responses for similar requests to optimize your cache\n * hit rates.\n * [Learn more](https://platform.openai.com/docs/guides/prompt-caching).\n */\n promptCacheKey: string;\n /**\n * The verbosity of the model's response.\n */\n verbosity?: OpenAIVerbosityParam;\n protected defaultOptions: CallOptions;\n _llmType(): string;\n static lc_name(): string;\n get callKeys(): string[];\n lc_serializable: boolean;\n get lc_secrets(): {\n [key: string]: string;\n } | undefined;\n get lc_aliases(): Record<string, string>;\n get lc_serializable_keys(): string[];\n getLsParams(options: this[\"ParsedCallOptions\"]): LangSmithParams;\n /** @ignore */\n _identifyingParams(): Omit<OpenAIClient.Chat.ChatCompletionCreateParams, \"messages\"> & {\n model_name: string;\n } & ClientOptions;\n /**\n * Get the identifying parameters for the model\n */\n identifyingParams(): Omit<OpenAIClient.ChatCompletionCreateParams, \"messages\"> & {\n model_name: string;\n } & ClientOptions;\n constructor(fields?: BaseChatOpenAIFields);\n /**\n * Returns backwards compatible reasoning parameters from constructor params and call options\n * @internal\n */\n protected _getReasoningParams(options?: this[\"ParsedCallOptions\"]): OpenAIClient.Reasoning | undefined;\n /**\n * Returns an openai compatible response format from a set of options\n * @internal\n */\n protected _getResponseFormat(resFormat?: CallOptions[\"response_format\"]): ResponseFormatConfiguration | undefined;\n protected _combineCallOptions(additionalOptions?: this[\"ParsedCallOptions\"]): this[\"ParsedCallOptions\"];\n /** @internal */\n _getClientOptions(options: OpenAICoreRequestOptions | undefined): OpenAICoreRequestOptions;\n // TODO: move to completions class\n protected _convertChatOpenAIToolToCompletionsTool(tool: ChatOpenAIToolType, fields?: {\n strict?: boolean;\n }): OpenAIClient.ChatCompletionTool;\n bindTools(tools: ChatOpenAIToolType[], kwargs?: Partial<CallOptions>): Runnable<BaseLanguageModelInput, AIMessageChunk, CallOptions>;\n stream(input: BaseLanguageModelInput, options?: CallOptions): Promise<import(\"../../../../langchain-core/dist/utils/stream.js\").IterableReadableStream<AIMessageChunk<import(\"@langchain/core/messages\").MessageStructure>>>;\n invoke(input: BaseLanguageModelInput, options?: CallOptions): Promise<AIMessageChunk<import(\"@langchain/core/messages\").MessageStructure>>;\n /** @ignore */\n _combineLLMOutput(...llmOutputs: OpenAILLMOutput[]): OpenAILLMOutput;\n getNumTokensFromMessages(messages: BaseMessage[]): Promise<{\n totalCount: number;\n countPerMessage: number[];\n }>;\n /** @internal */\n protected _getNumTokensFromGenerations(generations: ChatGeneration[]): Promise<number>;\n /** @internal */\n protected _getEstimatedTokenCountFromPrompt(messages: BaseMessage[], functions?: OpenAIClient.Chat.ChatCompletionCreateParams.Function[], function_call?: \"none\" | \"auto\" | OpenAIClient.Chat.ChatCompletionFunctionCallOption): Promise<number>;\n /** @internal */\n protected _getStructuredOutputMethod(config: StructuredOutputMethodOptions<boolean>): string | undefined;\n withStructuredOutput<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;\n withStructuredOutput<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {\n raw: BaseMessage;\n parsed: RunOutput;\n }>;\n withStructuredOutput<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: InteropZodType<RunOutput>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Record<string, any>, config?: StructuredOutputMethodOptions<boolean>): Runnable<BaseLanguageModelInput, RunOutput> | Runnable<BaseLanguageModelInput, {\n raw: BaseMessage;\n parsed: RunOutput;\n }>;\n}\n"],"mappings":"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"}
|