@langchain/openai 0.0.31 → 0.0.32
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.
|
@@ -24,6 +24,11 @@ class AzureChatOpenAI extends chat_models_js_1.ChatOpenAI {
|
|
|
24
24
|
}
|
|
25
25
|
super(newFields);
|
|
26
26
|
}
|
|
27
|
+
getLsParams(options) {
|
|
28
|
+
const params = super.getLsParams(options);
|
|
29
|
+
params.ls_provider = "azure";
|
|
30
|
+
return params;
|
|
31
|
+
}
|
|
27
32
|
_getClientOptions(options) {
|
|
28
33
|
if (!this.client) {
|
|
29
34
|
const openAIEndpointConfig = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ClientOptions } from "openai";
|
|
2
|
-
import { type BaseChatModelParams } from "@langchain/core/language_models/chat_models";
|
|
2
|
+
import { LangSmithParams, type BaseChatModelParams } from "@langchain/core/language_models/chat_models";
|
|
3
3
|
import { ChatOpenAI } from "../chat_models.js";
|
|
4
4
|
import { AzureOpenAIInput, LegacyOpenAIInput, OpenAIChatInput, OpenAICoreRequestOptions } from "../types.js";
|
|
5
5
|
export declare class AzureChatOpenAI extends ChatOpenAI {
|
|
@@ -13,6 +13,7 @@ export declare class AzureChatOpenAI extends ChatOpenAI {
|
|
|
13
13
|
} & BaseChatModelParams & {
|
|
14
14
|
configuration?: ClientOptions & LegacyOpenAIInput;
|
|
15
15
|
});
|
|
16
|
+
protected getLsParams(options: this["ParsedCallOptions"]): LangSmithParams;
|
|
16
17
|
protected _getClientOptions(options: OpenAICoreRequestOptions | undefined): OpenAICoreRequestOptions;
|
|
17
18
|
toJSON(): any;
|
|
18
19
|
}
|
|
@@ -21,6 +21,11 @@ export class AzureChatOpenAI extends ChatOpenAI {
|
|
|
21
21
|
}
|
|
22
22
|
super(newFields);
|
|
23
23
|
}
|
|
24
|
+
getLsParams(options) {
|
|
25
|
+
const params = super.getLsParams(options);
|
|
26
|
+
params.ls_provider = "azure";
|
|
27
|
+
return params;
|
|
28
|
+
}
|
|
24
29
|
_getClientOptions(options) {
|
|
25
30
|
if (!this.client) {
|
|
26
31
|
const openAIEndpointConfig = {
|
package/dist/chat_models.cjs
CHANGED
|
@@ -482,6 +482,17 @@ class ChatOpenAI extends chat_models_1.BaseChatModel {
|
|
|
482
482
|
...fields?.configuration,
|
|
483
483
|
};
|
|
484
484
|
}
|
|
485
|
+
getLsParams(options) {
|
|
486
|
+
const params = this.invocationParams(options);
|
|
487
|
+
return {
|
|
488
|
+
ls_provider: "openai",
|
|
489
|
+
ls_model_name: this.model,
|
|
490
|
+
ls_model_type: "chat",
|
|
491
|
+
ls_temperature: params.temperature ?? undefined,
|
|
492
|
+
ls_max_tokens: params.max_tokens ?? undefined,
|
|
493
|
+
ls_stop: options.stop,
|
|
494
|
+
};
|
|
495
|
+
}
|
|
485
496
|
bindTools(tools, kwargs) {
|
|
486
497
|
return this.bind({
|
|
487
498
|
tools: tools.map(function_calling_1.convertToOpenAITool),
|
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 { type StructuredToolInterface } from "@langchain/core/tools";
|
|
6
|
-
import { BaseChatModel, type BaseChatModelParams } from "@langchain/core/language_models/chat_models";
|
|
6
|
+
import { BaseChatModel, LangSmithParams, type BaseChatModelParams } from "@langchain/core/language_models/chat_models";
|
|
7
7
|
import type { BaseFunctionCallOptions, BaseLanguageModelInput, StructuredOutputMethodOptions, StructuredOutputMethodParams } from "@langchain/core/language_models/base";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { Runnable, RunnableInterface } from "@langchain/core/runnables";
|
|
@@ -103,6 +103,7 @@ export declare class ChatOpenAI<CallOptions extends ChatOpenAICallOptions = Chat
|
|
|
103
103
|
},
|
|
104
104
|
/** @deprecated */
|
|
105
105
|
configuration?: ClientOptions & LegacyOpenAIInput);
|
|
106
|
+
protected getLsParams(options: this["ParsedCallOptions"]): LangSmithParams;
|
|
106
107
|
bindTools(tools: (Record<string, unknown> | StructuredToolInterface)[], kwargs?: Partial<CallOptions>): RunnableInterface<BaseLanguageModelInput, AIMessageChunk, CallOptions>;
|
|
107
108
|
/**
|
|
108
109
|
* Get the parameters used to invoke the model
|
package/dist/chat_models.js
CHANGED
|
@@ -478,6 +478,17 @@ export class ChatOpenAI extends BaseChatModel {
|
|
|
478
478
|
...fields?.configuration,
|
|
479
479
|
};
|
|
480
480
|
}
|
|
481
|
+
getLsParams(options) {
|
|
482
|
+
const params = this.invocationParams(options);
|
|
483
|
+
return {
|
|
484
|
+
ls_provider: "openai",
|
|
485
|
+
ls_model_name: this.model,
|
|
486
|
+
ls_model_type: "chat",
|
|
487
|
+
ls_temperature: params.temperature ?? undefined,
|
|
488
|
+
ls_max_tokens: params.max_tokens ?? undefined,
|
|
489
|
+
ls_stop: options.stop,
|
|
490
|
+
};
|
|
491
|
+
}
|
|
481
492
|
bindTools(tools, kwargs) {
|
|
482
493
|
return this.bind({
|
|
483
494
|
tools: tools.map(convertToOpenAITool),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/openai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "OpenAI integrations for LangChain.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"author": "LangChain",
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@langchain/core": "
|
|
42
|
+
"@langchain/core": ">0.1.56 <0.3.0",
|
|
43
43
|
"js-tiktoken": "^1.0.12",
|
|
44
44
|
"openai": "^4.41.1",
|
|
45
45
|
"zod": "^3.22.4",
|