langchain 0.0.129 → 0.0.131
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/agents/chat/index.cjs +3 -0
- package/dist/agents/chat/index.d.ts +1 -0
- package/dist/agents/chat/index.js +3 -0
- package/dist/agents/chat_convo/index.cjs +3 -0
- package/dist/agents/chat_convo/index.d.ts +1 -0
- package/dist/agents/chat_convo/index.js +3 -0
- package/dist/agents/executor.cjs +3 -0
- package/dist/agents/executor.d.ts +1 -0
- package/dist/agents/executor.js +3 -0
- package/dist/agents/mrkl/index.cjs +3 -0
- package/dist/agents/mrkl/index.d.ts +1 -0
- package/dist/agents/mrkl/index.js +3 -0
- package/dist/agents/openai/index.cjs +3 -0
- package/dist/agents/openai/index.d.ts +1 -0
- package/dist/agents/openai/index.js +3 -0
- package/dist/agents/structured_chat/index.cjs +3 -0
- package/dist/agents/structured_chat/index.d.ts +1 -0
- package/dist/agents/structured_chat/index.js +3 -0
- package/dist/callbacks/base.cjs +18 -0
- package/dist/callbacks/base.d.ts +15 -0
- package/dist/callbacks/base.js +19 -1
- package/dist/callbacks/manager.cjs +1 -1
- package/dist/callbacks/manager.js +1 -1
- package/dist/chains/analyze_documents_chain.cjs +3 -0
- package/dist/chains/analyze_documents_chain.d.ts +1 -0
- package/dist/chains/analyze_documents_chain.js +3 -0
- package/dist/chains/combine_docs_chain.cjs +9 -0
- package/dist/chains/combine_docs_chain.d.ts +3 -0
- package/dist/chains/combine_docs_chain.js +9 -0
- package/dist/chains/constitutional_ai/constitutional_chain.cjs +3 -0
- package/dist/chains/constitutional_ai/constitutional_chain.d.ts +1 -0
- package/dist/chains/constitutional_ai/constitutional_chain.js +3 -0
- package/dist/chains/conversation.cjs +3 -0
- package/dist/chains/conversation.d.ts +1 -0
- package/dist/chains/conversation.js +3 -0
- package/dist/chains/conversational_retrieval_chain.cjs +3 -0
- package/dist/chains/conversational_retrieval_chain.d.ts +1 -0
- package/dist/chains/conversational_retrieval_chain.js +3 -0
- package/dist/chains/llm_chain.cjs +3 -0
- package/dist/chains/llm_chain.d.ts +1 -0
- package/dist/chains/llm_chain.js +3 -0
- package/dist/chains/openai_functions/openapi.cjs +3 -0
- package/dist/chains/openai_functions/openapi.js +3 -0
- package/dist/chains/openai_moderation.cjs +3 -0
- package/dist/chains/openai_moderation.d.ts +1 -0
- package/dist/chains/openai_moderation.js +3 -0
- package/dist/chains/retrieval_qa.cjs +3 -0
- package/dist/chains/retrieval_qa.d.ts +1 -0
- package/dist/chains/retrieval_qa.js +3 -0
- package/dist/chains/router/multi_route.cjs +3 -0
- package/dist/chains/router/multi_route.d.ts +1 -0
- package/dist/chains/router/multi_route.js +3 -0
- package/dist/chains/sequential_chain.cjs +6 -0
- package/dist/chains/sequential_chain.d.ts +2 -0
- package/dist/chains/sequential_chain.js +6 -0
- package/dist/chains/sql_db/sql_db_chain.cjs +3 -0
- package/dist/chains/sql_db/sql_db_chain.d.ts +1 -0
- package/dist/chains/sql_db/sql_db_chain.js +3 -0
- package/dist/chains/transform.cjs +3 -0
- package/dist/chains/transform.d.ts +1 -0
- package/dist/chains/transform.js +3 -0
- package/dist/chains/vector_db_qa.cjs +3 -0
- package/dist/chains/vector_db_qa.d.ts +1 -0
- package/dist/chains/vector_db_qa.js +3 -0
- package/dist/chat_models/anthropic.cjs +3 -0
- package/dist/chat_models/anthropic.d.ts +1 -0
- package/dist/chat_models/anthropic.js +3 -0
- package/dist/chat_models/baiduwenxin.cjs +3 -13
- package/dist/chat_models/baiduwenxin.d.ts +1 -3
- package/dist/chat_models/baiduwenxin.js +3 -13
- package/dist/chat_models/googlepalm.cjs +9 -0
- package/dist/chat_models/googlepalm.d.ts +2 -0
- package/dist/chat_models/googlepalm.js +9 -0
- package/dist/chat_models/googlevertexai.cjs +9 -0
- package/dist/chat_models/googlevertexai.d.ts +2 -0
- package/dist/chat_models/googlevertexai.js +9 -0
- package/dist/chat_models/ollama.cjs +3 -0
- package/dist/chat_models/ollama.d.ts +1 -0
- package/dist/chat_models/ollama.js +3 -0
- package/dist/chat_models/openai.cjs +19 -5
- package/dist/chat_models/openai.d.ts +7 -5
- package/dist/chat_models/openai.js +19 -5
- package/dist/document_loaders/web/youtube.cjs +77 -0
- package/dist/document_loaders/web/youtube.d.ts +17 -0
- package/dist/document_loaders/web/youtube.js +73 -0
- package/dist/document_transformers/html_to_text.cjs +3 -0
- package/dist/document_transformers/html_to_text.d.ts +1 -0
- package/dist/document_transformers/html_to_text.js +3 -0
- package/dist/document_transformers/mozilla_readability.cjs +3 -0
- package/dist/document_transformers/mozilla_readability.d.ts +1 -0
- package/dist/document_transformers/mozilla_readability.js +3 -0
- package/dist/document_transformers/openai_functions.cjs +3 -0
- package/dist/document_transformers/openai_functions.d.ts +1 -0
- package/dist/document_transformers/openai_functions.js +3 -0
- package/dist/embeddings/cohere.cjs +16 -13
- package/dist/embeddings/cohere.js +16 -13
- package/dist/embeddings/googlevertexai.cjs +1 -1
- package/dist/embeddings/googlevertexai.js +1 -1
- package/dist/embeddings/openai.cjs +27 -21
- package/dist/embeddings/openai.js +27 -21
- package/dist/evaluation/qa/eval_chain.cjs +3 -0
- package/dist/evaluation/qa/eval_chain.d.ts +1 -0
- package/dist/evaluation/qa/eval_chain.js +3 -0
- package/dist/experimental/babyagi/agent.cjs +3 -0
- package/dist/experimental/babyagi/agent.d.ts +1 -0
- package/dist/experimental/babyagi/agent.js +3 -0
- package/dist/experimental/babyagi/task_creation.cjs +3 -0
- package/dist/experimental/babyagi/task_creation.d.ts +1 -0
- package/dist/experimental/babyagi/task_creation.js +3 -0
- package/dist/experimental/babyagi/task_execution.cjs +3 -0
- package/dist/experimental/babyagi/task_execution.d.ts +1 -0
- package/dist/experimental/babyagi/task_execution.js +3 -0
- package/dist/experimental/babyagi/task_prioritization.cjs +3 -0
- package/dist/experimental/babyagi/task_prioritization.d.ts +1 -0
- package/dist/experimental/babyagi/task_prioritization.js +3 -0
- package/dist/experimental/generative_agents/generative_agent.cjs +3 -0
- package/dist/experimental/generative_agents/generative_agent.d.ts +1 -0
- package/dist/experimental/generative_agents/generative_agent.js +3 -0
- package/dist/experimental/generative_agents/generative_agent_memory.cjs +3 -0
- package/dist/experimental/generative_agents/generative_agent_memory.d.ts +1 -0
- package/dist/experimental/generative_agents/generative_agent_memory.js +3 -0
- package/dist/experimental/plan_and_execute/agent_executor.cjs +3 -0
- package/dist/experimental/plan_and_execute/agent_executor.d.ts +1 -0
- package/dist/experimental/plan_and_execute/agent_executor.js +3 -0
- package/dist/llms/cohere.cjs +3 -0
- package/dist/llms/cohere.d.ts +1 -0
- package/dist/llms/cohere.js +3 -0
- package/dist/llms/ollama.cjs +3 -0
- package/dist/llms/ollama.d.ts +1 -0
- package/dist/llms/ollama.js +3 -0
- package/dist/llms/openai-chat.cjs +18 -4
- package/dist/llms/openai-chat.d.ts +6 -4
- package/dist/llms/openai-chat.js +18 -4
- package/dist/llms/openai.cjs +20 -6
- package/dist/llms/openai.d.ts +5 -3
- package/dist/llms/openai.js +20 -6
- package/dist/llms/replicate.cjs +3 -0
- package/dist/llms/replicate.d.ts +1 -0
- package/dist/llms/replicate.js +3 -0
- package/dist/load/import_constants.cjs +1 -0
- package/dist/load/import_constants.js +1 -0
- package/dist/load/index.cjs +7 -1
- package/dist/load/index.js +7 -1
- package/dist/load/serializable.cjs +42 -3
- package/dist/load/serializable.d.ts +16 -0
- package/dist/load/serializable.js +40 -2
- package/dist/output_parsers/combining.cjs +3 -0
- package/dist/output_parsers/combining.d.ts +1 -0
- package/dist/output_parsers/combining.js +3 -0
- package/dist/output_parsers/fix.cjs +3 -0
- package/dist/output_parsers/fix.d.ts +1 -0
- package/dist/output_parsers/fix.js +3 -0
- package/dist/output_parsers/list.cjs +3 -0
- package/dist/output_parsers/list.d.ts +1 -0
- package/dist/output_parsers/list.js +3 -0
- package/dist/output_parsers/noop.cjs +3 -0
- package/dist/output_parsers/noop.d.ts +1 -0
- package/dist/output_parsers/noop.js +3 -0
- package/dist/output_parsers/openai_functions.cjs +9 -0
- package/dist/output_parsers/openai_functions.d.ts +3 -0
- package/dist/output_parsers/openai_functions.js +9 -0
- package/dist/output_parsers/regex.cjs +3 -0
- package/dist/output_parsers/regex.d.ts +1 -0
- package/dist/output_parsers/regex.js +3 -0
- package/dist/output_parsers/structured.cjs +6 -0
- package/dist/output_parsers/structured.d.ts +2 -0
- package/dist/output_parsers/structured.js +6 -0
- package/dist/prompts/chat.cjs +21 -0
- package/dist/prompts/chat.d.ts +7 -0
- package/dist/prompts/chat.js +21 -0
- package/dist/prompts/pipeline.cjs +3 -0
- package/dist/prompts/pipeline.d.ts +1 -0
- package/dist/prompts/pipeline.js +3 -0
- package/dist/prompts/prompt.cjs +3 -0
- package/dist/prompts/prompt.d.ts +1 -0
- package/dist/prompts/prompt.js +3 -0
- package/dist/retrievers/amazon_kendra.cjs +3 -0
- package/dist/retrievers/amazon_kendra.d.ts +1 -0
- package/dist/retrievers/amazon_kendra.js +3 -0
- package/dist/retrievers/contextual_compression.cjs +3 -0
- package/dist/retrievers/contextual_compression.d.ts +1 -0
- package/dist/retrievers/contextual_compression.js +3 -0
- package/dist/retrievers/databerry.cjs +3 -0
- package/dist/retrievers/databerry.d.ts +1 -0
- package/dist/retrievers/databerry.js +3 -0
- package/dist/retrievers/hyde.cjs +3 -0
- package/dist/retrievers/hyde.d.ts +1 -0
- package/dist/retrievers/hyde.js +3 -0
- package/dist/retrievers/metal.cjs +3 -0
- package/dist/retrievers/metal.d.ts +1 -0
- package/dist/retrievers/metal.js +3 -0
- package/dist/retrievers/parent_document.cjs +3 -0
- package/dist/retrievers/parent_document.d.ts +1 -0
- package/dist/retrievers/parent_document.js +3 -0
- package/dist/retrievers/self_query/index.cjs +3 -0
- package/dist/retrievers/self_query/index.d.ts +1 -0
- package/dist/retrievers/self_query/index.js +3 -0
- package/dist/retrievers/self_query/supabase.cjs +28 -7
- package/dist/retrievers/self_query/supabase.d.ts +2 -2
- package/dist/retrievers/self_query/supabase.js +29 -8
- package/dist/retrievers/self_query/supabase_utils.cjs +177 -0
- package/dist/retrievers/self_query/supabase_utils.d.ts +24 -0
- package/dist/retrievers/self_query/supabase_utils.js +172 -0
- package/dist/retrievers/self_query/utils.cjs +19 -3
- package/dist/retrievers/self_query/utils.d.ts +3 -0
- package/dist/retrievers/self_query/utils.js +15 -2
- package/dist/retrievers/self_query/weaviate.cjs +3 -14
- package/dist/retrievers/self_query/weaviate.js +1 -12
- package/dist/retrievers/supabase.cjs +3 -0
- package/dist/retrievers/supabase.d.ts +1 -0
- package/dist/retrievers/supabase.js +3 -0
- package/dist/retrievers/time_weighted.cjs +3 -0
- package/dist/retrievers/time_weighted.d.ts +1 -0
- package/dist/retrievers/time_weighted.js +3 -0
- package/dist/retrievers/vespa.cjs +3 -0
- package/dist/retrievers/vespa.d.ts +1 -0
- package/dist/retrievers/vespa.js +3 -0
- package/dist/retrievers/zep.cjs +3 -0
- package/dist/retrievers/zep.d.ts +1 -0
- package/dist/retrievers/zep.js +3 -0
- package/dist/schema/index.cjs +32 -2
- package/dist/schema/index.d.ts +14 -0
- package/dist/schema/index.js +32 -2
- package/dist/schema/output_parser.cjs +6 -0
- package/dist/schema/output_parser.d.ts +2 -0
- package/dist/schema/output_parser.js +6 -0
- package/dist/schema/runnable.cjs +25 -7
- package/dist/schema/runnable.d.ts +6 -0
- package/dist/schema/runnable.js +25 -7
- package/dist/stores/message/utils.cjs +5 -0
- package/dist/stores/message/utils.js +6 -1
- package/dist/text_splitter.cjs +9 -0
- package/dist/text_splitter.d.ts +3 -0
- package/dist/text_splitter.js +9 -0
- package/dist/tools/IFTTTWebhook.cjs +3 -0
- package/dist/tools/IFTTTWebhook.d.ts +1 -0
- package/dist/tools/IFTTTWebhook.js +3 -0
- package/dist/tools/aiplugin.cjs +3 -0
- package/dist/tools/aiplugin.d.ts +1 -0
- package/dist/tools/aiplugin.js +3 -0
- package/dist/tools/aws_sfn.cjs +9 -0
- package/dist/tools/aws_sfn.d.ts +3 -0
- package/dist/tools/aws_sfn.js +9 -0
- package/dist/tools/bingserpapi.cjs +3 -0
- package/dist/tools/bingserpapi.d.ts +1 -0
- package/dist/tools/bingserpapi.js +3 -0
- package/dist/tools/brave_search.cjs +3 -0
- package/dist/tools/brave_search.d.ts +1 -0
- package/dist/tools/brave_search.js +3 -0
- package/dist/tools/calculator.cjs +3 -0
- package/dist/tools/calculator.d.ts +1 -0
- package/dist/tools/calculator.js +3 -0
- package/dist/tools/chain.cjs +3 -0
- package/dist/tools/chain.d.ts +1 -0
- package/dist/tools/chain.js +3 -0
- package/dist/tools/dadjokeapi.cjs +3 -0
- package/dist/tools/dadjokeapi.d.ts +1 -0
- package/dist/tools/dadjokeapi.js +3 -0
- package/dist/tools/dataforseo_api_search.cjs +3 -0
- package/dist/tools/dataforseo_api_search.d.ts +1 -0
- package/dist/tools/dataforseo_api_search.js +3 -0
- package/dist/tools/dynamic.cjs +6 -0
- package/dist/tools/dynamic.d.ts +2 -0
- package/dist/tools/dynamic.js +6 -0
- package/dist/tools/fs.cjs +6 -0
- package/dist/tools/fs.d.ts +2 -0
- package/dist/tools/fs.js +6 -0
- package/dist/tools/google_custom_search.cjs +3 -0
- package/dist/tools/google_custom_search.d.ts +1 -0
- package/dist/tools/google_custom_search.js +3 -0
- package/dist/tools/json.cjs +7 -1
- package/dist/tools/json.d.ts +2 -0
- package/dist/tools/json.js +7 -1
- package/dist/tools/requests.cjs +8 -2
- package/dist/tools/requests.d.ts +2 -0
- package/dist/tools/requests.js +8 -2
- package/dist/tools/searxng_search.cjs +3 -0
- package/dist/tools/searxng_search.d.ts +1 -0
- package/dist/tools/searxng_search.js +3 -0
- package/dist/tools/serpapi.cjs +3 -0
- package/dist/tools/serpapi.d.ts +1 -0
- package/dist/tools/serpapi.js +3 -0
- package/dist/tools/serper.cjs +3 -0
- package/dist/tools/serper.d.ts +1 -0
- package/dist/tools/serper.js +3 -0
- package/dist/tools/sql.cjs +12 -0
- package/dist/tools/sql.d.ts +4 -0
- package/dist/tools/sql.js +12 -0
- package/dist/tools/vectorstore.cjs +3 -0
- package/dist/tools/vectorstore.d.ts +1 -0
- package/dist/tools/vectorstore.js +3 -0
- package/dist/tools/webbrowser.cjs +3 -0
- package/dist/tools/webbrowser.d.ts +1 -0
- package/dist/tools/webbrowser.js +3 -0
- package/dist/tools/wikipedia_query_run.cjs +3 -0
- package/dist/tools/wikipedia_query_run.d.ts +1 -0
- package/dist/tools/wikipedia_query_run.js +3 -0
- package/dist/tools/zapier.cjs +3 -0
- package/dist/tools/zapier.d.ts +1 -0
- package/dist/tools/zapier.js +3 -0
- package/dist/vectorstores/base.cjs +3 -0
- package/dist/vectorstores/base.d.ts +1 -0
- package/dist/vectorstores/base.js +3 -0
- package/dist/vectorstores/elasticsearch.cjs +1 -0
- package/dist/vectorstores/elasticsearch.js +1 -0
- package/dist/vectorstores/hnswlib.cjs +19 -0
- package/dist/vectorstores/hnswlib.d.ts +3 -0
- package/dist/vectorstores/hnswlib.js +19 -0
- package/dist/vectorstores/myscale.cjs +1 -1
- package/dist/vectorstores/myscale.js +1 -1
- package/dist/vectorstores/supabase.d.ts +1 -2
- package/document_loaders/web/youtube.cjs +1 -0
- package/document_loaders/web/youtube.d.ts +1 -0
- package/document_loaders/web/youtube.js +1 -0
- package/package.json +27 -3
|
@@ -12,6 +12,9 @@ function formatSet(input) {
|
|
|
12
12
|
* Chain where the outputs of one chain feed directly into next.
|
|
13
13
|
*/
|
|
14
14
|
class SequentialChain extends base_js_1.BaseChain {
|
|
15
|
+
static lc_name() {
|
|
16
|
+
return "SequentialChain";
|
|
17
|
+
}
|
|
15
18
|
get inputKeys() {
|
|
16
19
|
return this.inputVariables;
|
|
17
20
|
}
|
|
@@ -182,6 +185,9 @@ exports.SequentialChain = SequentialChain;
|
|
|
182
185
|
* ```
|
|
183
186
|
*/
|
|
184
187
|
class SimpleSequentialChain extends base_js_1.BaseChain {
|
|
188
|
+
static lc_name() {
|
|
189
|
+
return "SimpleSequentialChain";
|
|
190
|
+
}
|
|
185
191
|
get inputKeys() {
|
|
186
192
|
return [this.inputKey];
|
|
187
193
|
}
|
|
@@ -16,6 +16,7 @@ export interface SequentialChainInput extends ChainInputs {
|
|
|
16
16
|
* Chain where the outputs of one chain feed directly into next.
|
|
17
17
|
*/
|
|
18
18
|
export declare class SequentialChain extends BaseChain implements SequentialChainInput {
|
|
19
|
+
static lc_name(): string;
|
|
19
20
|
chains: BaseChain[];
|
|
20
21
|
inputVariables: string[];
|
|
21
22
|
outputVariables: string[];
|
|
@@ -74,6 +75,7 @@ export interface SimpleSequentialChainInput extends ChainInputs {
|
|
|
74
75
|
* ```
|
|
75
76
|
*/
|
|
76
77
|
export declare class SimpleSequentialChain extends BaseChain implements SimpleSequentialChainInput {
|
|
78
|
+
static lc_name(): string;
|
|
77
79
|
chains: Array<BaseChain>;
|
|
78
80
|
inputKey: string;
|
|
79
81
|
outputKey: string;
|
|
@@ -9,6 +9,9 @@ function formatSet(input) {
|
|
|
9
9
|
* Chain where the outputs of one chain feed directly into next.
|
|
10
10
|
*/
|
|
11
11
|
export class SequentialChain extends BaseChain {
|
|
12
|
+
static lc_name() {
|
|
13
|
+
return "SequentialChain";
|
|
14
|
+
}
|
|
12
15
|
get inputKeys() {
|
|
13
16
|
return this.inputVariables;
|
|
14
17
|
}
|
|
@@ -178,6 +181,9 @@ export class SequentialChain extends BaseChain {
|
|
|
178
181
|
* ```
|
|
179
182
|
*/
|
|
180
183
|
export class SimpleSequentialChain extends BaseChain {
|
|
184
|
+
static lc_name() {
|
|
185
|
+
return "SimpleSequentialChain";
|
|
186
|
+
}
|
|
181
187
|
get inputKeys() {
|
|
182
188
|
return [this.inputKey];
|
|
183
189
|
}
|
|
@@ -7,6 +7,9 @@ const llm_chain_js_1 = require("../llm_chain.cjs");
|
|
|
7
7
|
const count_tokens_js_1 = require("../../base_language/count_tokens.cjs");
|
|
8
8
|
const sql_utils_js_1 = require("../../util/sql_utils.cjs");
|
|
9
9
|
class SqlDatabaseChain extends base_js_1.BaseChain {
|
|
10
|
+
static lc_name() {
|
|
11
|
+
return "SqlDatabaseChain";
|
|
12
|
+
}
|
|
10
13
|
constructor(fields) {
|
|
11
14
|
super(fields);
|
|
12
15
|
// LLM wrapper to use
|
|
@@ -14,6 +14,7 @@ export interface SqlDatabaseChainInput extends ChainInputs {
|
|
|
14
14
|
prompt?: PromptTemplate;
|
|
15
15
|
}
|
|
16
16
|
export declare class SqlDatabaseChain extends BaseChain {
|
|
17
|
+
static lc_name(): string;
|
|
17
18
|
llm: BaseLanguageModel;
|
|
18
19
|
database: SqlDatabase;
|
|
19
20
|
prompt: PromptTemplate<{
|
|
@@ -4,6 +4,9 @@ import { LLMChain } from "../llm_chain.js";
|
|
|
4
4
|
import { calculateMaxTokens, getModelContextSize, } from "../../base_language/count_tokens.js";
|
|
5
5
|
import { getPromptTemplateFromDataSource } from "../../util/sql_utils.js";
|
|
6
6
|
export class SqlDatabaseChain extends BaseChain {
|
|
7
|
+
static lc_name() {
|
|
8
|
+
return "SqlDatabaseChain";
|
|
9
|
+
}
|
|
7
10
|
constructor(fields) {
|
|
8
11
|
super(fields);
|
|
9
12
|
// LLM wrapper to use
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TransformChain = void 0;
|
|
4
4
|
const base_js_1 = require("./base.cjs");
|
|
5
5
|
class TransformChain extends base_js_1.BaseChain {
|
|
6
|
+
static lc_name() {
|
|
7
|
+
return "TransformChain";
|
|
8
|
+
}
|
|
6
9
|
_chainType() {
|
|
7
10
|
return "transform";
|
|
8
11
|
}
|
|
@@ -7,6 +7,7 @@ export interface TransformChainFields<I extends ChainValues, O extends ChainValu
|
|
|
7
7
|
outputVariables: (keyof O extends string ? keyof O : never)[];
|
|
8
8
|
}
|
|
9
9
|
export declare class TransformChain<I extends ChainValues, O extends ChainValues> extends BaseChain {
|
|
10
|
+
static lc_name(): string;
|
|
10
11
|
transformFunc: (values: I, callbacks?: Callbacks) => O | Promise<O>;
|
|
11
12
|
inputVariables: (keyof I extends string ? keyof I : never)[];
|
|
12
13
|
outputVariables: (keyof O extends string ? keyof O : never)[];
|
package/dist/chains/transform.js
CHANGED
|
@@ -4,6 +4,9 @@ exports.VectorDBQAChain = void 0;
|
|
|
4
4
|
const base_js_1 = require("./base.cjs");
|
|
5
5
|
const load_js_1 = require("./question_answering/load.cjs");
|
|
6
6
|
class VectorDBQAChain extends base_js_1.BaseChain {
|
|
7
|
+
static lc_name() {
|
|
8
|
+
return "VectorDBQAChain";
|
|
9
|
+
}
|
|
7
10
|
get inputKeys() {
|
|
8
11
|
return [this.inputKey];
|
|
9
12
|
}
|
|
@@ -13,6 +13,7 @@ export interface VectorDBQAChainInput extends Omit<ChainInputs, "memory"> {
|
|
|
13
13
|
inputKey?: string;
|
|
14
14
|
}
|
|
15
15
|
export declare class VectorDBQAChain extends BaseChain implements VectorDBQAChainInput {
|
|
16
|
+
static lc_name(): string;
|
|
16
17
|
k: number;
|
|
17
18
|
inputKey: string;
|
|
18
19
|
get inputKeys(): string[];
|
|
@@ -40,6 +40,9 @@ function messageToWenxinRole(message) {
|
|
|
40
40
|
* @augments BaiduERNIEInput
|
|
41
41
|
*/
|
|
42
42
|
class ChatBaiduWenxin extends base_js_1.BaseChatModel {
|
|
43
|
+
static lc_name() {
|
|
44
|
+
return "ChatBaiduWenxin";
|
|
45
|
+
}
|
|
43
46
|
get callKeys() {
|
|
44
47
|
return ["stop", "signal", "options"];
|
|
45
48
|
}
|
|
@@ -146,23 +149,10 @@ class ChatBaiduWenxin extends base_js_1.BaseChatModel {
|
|
|
146
149
|
if (this.modelName === "ERNIE-Bot") {
|
|
147
150
|
this.apiUrl =
|
|
148
151
|
"https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions";
|
|
149
|
-
this.temperature = this.temperature ?? 0.95;
|
|
150
|
-
this.topP = this.topP ?? 0.8;
|
|
151
|
-
this.penaltyScore = this.penaltyScore ?? 1.0;
|
|
152
152
|
}
|
|
153
153
|
else if (this.modelName === "ERNIE-Bot-turbo") {
|
|
154
154
|
this.apiUrl =
|
|
155
155
|
"https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant";
|
|
156
|
-
// Validate the input
|
|
157
|
-
if (this.temperature) {
|
|
158
|
-
throw new Error("Temperature is not supported forERNIE-Bot-turbo model");
|
|
159
|
-
}
|
|
160
|
-
if (this.topP) {
|
|
161
|
-
throw new Error("TopP is not supported for ERNIE-Bot-turbo model");
|
|
162
|
-
}
|
|
163
|
-
if (this.penaltyScore) {
|
|
164
|
-
throw new Error("PenaltyScore is not supported for ERNIE-Bot-turbo model");
|
|
165
|
-
}
|
|
166
156
|
}
|
|
167
157
|
else {
|
|
168
158
|
throw new Error(`Invalid model name: ${this.modelName}`);
|
|
@@ -41,17 +41,14 @@ declare interface BaiduWenxinChatInput {
|
|
|
41
41
|
* from 0 to 1 (0 is not included). Use temp closer to 0 for analytical /
|
|
42
42
|
* multiple choice, and temp closer to 1 for creative
|
|
43
43
|
* and generative tasks. Defaults to 0.95.
|
|
44
|
-
* Only supported for `modelName` of `WenxinModelName.ERNIE_BOT`.
|
|
45
44
|
*/
|
|
46
45
|
temperature?: number;
|
|
47
46
|
/** Total probability mass of tokens to consider at each step. Range
|
|
48
47
|
* from 0 to 1.0. Defaults to 0.8.
|
|
49
|
-
* Only supported for `modelName` of `WenxinModelName.ERNIE_BOT`.
|
|
50
48
|
*/
|
|
51
49
|
topP?: number;
|
|
52
50
|
/** Penalizes repeated tokens according to frequency. Range
|
|
53
51
|
* from 1.0 to 2.0. Defaults to 1.0.
|
|
54
|
-
* Only supported for `modelName` of `WenxinModelName.ERNIE_BOT`.
|
|
55
52
|
*/
|
|
56
53
|
penaltyScore?: number;
|
|
57
54
|
}
|
|
@@ -65,6 +62,7 @@ declare interface BaiduWenxinChatInput {
|
|
|
65
62
|
* @augments BaiduERNIEInput
|
|
66
63
|
*/
|
|
67
64
|
export declare class ChatBaiduWenxin extends BaseChatModel implements BaiduWenxinChatInput {
|
|
65
|
+
static lc_name(): string;
|
|
68
66
|
get callKeys(): string[];
|
|
69
67
|
get lc_secrets(): {
|
|
70
68
|
[key: string]: string;
|
|
@@ -37,6 +37,9 @@ function messageToWenxinRole(message) {
|
|
|
37
37
|
* @augments BaiduERNIEInput
|
|
38
38
|
*/
|
|
39
39
|
export class ChatBaiduWenxin extends BaseChatModel {
|
|
40
|
+
static lc_name() {
|
|
41
|
+
return "ChatBaiduWenxin";
|
|
42
|
+
}
|
|
40
43
|
get callKeys() {
|
|
41
44
|
return ["stop", "signal", "options"];
|
|
42
45
|
}
|
|
@@ -143,23 +146,10 @@ export class ChatBaiduWenxin extends BaseChatModel {
|
|
|
143
146
|
if (this.modelName === "ERNIE-Bot") {
|
|
144
147
|
this.apiUrl =
|
|
145
148
|
"https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions";
|
|
146
|
-
this.temperature = this.temperature ?? 0.95;
|
|
147
|
-
this.topP = this.topP ?? 0.8;
|
|
148
|
-
this.penaltyScore = this.penaltyScore ?? 1.0;
|
|
149
149
|
}
|
|
150
150
|
else if (this.modelName === "ERNIE-Bot-turbo") {
|
|
151
151
|
this.apiUrl =
|
|
152
152
|
"https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant";
|
|
153
|
-
// Validate the input
|
|
154
|
-
if (this.temperature) {
|
|
155
|
-
throw new Error("Temperature is not supported forERNIE-Bot-turbo model");
|
|
156
|
-
}
|
|
157
|
-
if (this.topP) {
|
|
158
|
-
throw new Error("TopP is not supported for ERNIE-Bot-turbo model");
|
|
159
|
-
}
|
|
160
|
-
if (this.penaltyScore) {
|
|
161
|
-
throw new Error("PenaltyScore is not supported for ERNIE-Bot-turbo model");
|
|
162
|
-
}
|
|
163
153
|
}
|
|
164
154
|
else {
|
|
165
155
|
throw new Error(`Invalid model name: ${this.modelName}`);
|
|
@@ -14,6 +14,9 @@ function getMessageAuthor(message) {
|
|
|
14
14
|
return message.name ?? type;
|
|
15
15
|
}
|
|
16
16
|
class ChatGooglePaLM extends base_js_1.BaseChatModel {
|
|
17
|
+
static lc_name() {
|
|
18
|
+
return "ChatGooglePaLM";
|
|
19
|
+
}
|
|
17
20
|
get lc_secrets() {
|
|
18
21
|
return {
|
|
19
22
|
apiKey: "GOOGLE_PALM_API_KEY",
|
|
@@ -21,6 +24,12 @@ class ChatGooglePaLM extends base_js_1.BaseChatModel {
|
|
|
21
24
|
}
|
|
22
25
|
constructor(fields) {
|
|
23
26
|
super(fields ?? {});
|
|
27
|
+
Object.defineProperty(this, "lc_serializable", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true,
|
|
31
|
+
value: true
|
|
32
|
+
});
|
|
24
33
|
Object.defineProperty(this, "modelName", {
|
|
25
34
|
enumerable: true,
|
|
26
35
|
configurable: true,
|
|
@@ -51,6 +51,8 @@ export interface GooglePaLMChatInput extends BaseChatModelParams {
|
|
|
51
51
|
apiKey?: string;
|
|
52
52
|
}
|
|
53
53
|
export declare class ChatGooglePaLM extends BaseChatModel implements GooglePaLMChatInput {
|
|
54
|
+
static lc_name(): string;
|
|
55
|
+
lc_serializable: boolean;
|
|
54
56
|
get lc_secrets(): {
|
|
55
57
|
[key: string]: string;
|
|
56
58
|
} | undefined;
|
|
@@ -11,6 +11,9 @@ function getMessageAuthor(message) {
|
|
|
11
11
|
return message.name ?? type;
|
|
12
12
|
}
|
|
13
13
|
export class ChatGooglePaLM extends BaseChatModel {
|
|
14
|
+
static lc_name() {
|
|
15
|
+
return "ChatGooglePaLM";
|
|
16
|
+
}
|
|
14
17
|
get lc_secrets() {
|
|
15
18
|
return {
|
|
16
19
|
apiKey: "GOOGLE_PALM_API_KEY",
|
|
@@ -18,6 +21,12 @@ export class ChatGooglePaLM extends BaseChatModel {
|
|
|
18
21
|
}
|
|
19
22
|
constructor(fields) {
|
|
20
23
|
super(fields ?? {});
|
|
24
|
+
Object.defineProperty(this, "lc_serializable", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: true
|
|
29
|
+
});
|
|
21
30
|
Object.defineProperty(this, "modelName", {
|
|
22
31
|
enumerable: true,
|
|
23
32
|
configurable: true,
|
|
@@ -78,8 +78,17 @@ exports.GoogleVertexAIChatMessage = GoogleVertexAIChatMessage;
|
|
|
78
78
|
* Google Cloud project using Vertex AI.
|
|
79
79
|
*/
|
|
80
80
|
class ChatGoogleVertexAI extends base_js_1.BaseChatModel {
|
|
81
|
+
static lc_name() {
|
|
82
|
+
return "ChatGoogleVertexAI";
|
|
83
|
+
}
|
|
81
84
|
constructor(fields) {
|
|
82
85
|
super(fields ?? {});
|
|
86
|
+
Object.defineProperty(this, "lc_serializable", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
configurable: true,
|
|
89
|
+
writable: true,
|
|
90
|
+
value: true
|
|
91
|
+
});
|
|
83
92
|
Object.defineProperty(this, "model", {
|
|
84
93
|
enumerable: true,
|
|
85
94
|
configurable: true,
|
|
@@ -59,6 +59,8 @@ export interface GoogleVertexAIChatInput extends GoogleVertexAIBaseLLMInput {
|
|
|
59
59
|
* Google Cloud project using Vertex AI.
|
|
60
60
|
*/
|
|
61
61
|
export declare class ChatGoogleVertexAI extends BaseChatModel implements GoogleVertexAIChatInput {
|
|
62
|
+
static lc_name(): string;
|
|
63
|
+
lc_serializable: boolean;
|
|
62
64
|
model: string;
|
|
63
65
|
temperature: number;
|
|
64
66
|
maxOutputTokens: number;
|
|
@@ -74,8 +74,17 @@ export class GoogleVertexAIChatMessage {
|
|
|
74
74
|
* Google Cloud project using Vertex AI.
|
|
75
75
|
*/
|
|
76
76
|
export class ChatGoogleVertexAI extends BaseChatModel {
|
|
77
|
+
static lc_name() {
|
|
78
|
+
return "ChatGoogleVertexAI";
|
|
79
|
+
}
|
|
77
80
|
constructor(fields) {
|
|
78
81
|
super(fields ?? {});
|
|
82
|
+
Object.defineProperty(this, "lc_serializable", {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
configurable: true,
|
|
85
|
+
writable: true,
|
|
86
|
+
value: true
|
|
87
|
+
});
|
|
79
88
|
Object.defineProperty(this, "model", {
|
|
80
89
|
enumerable: true,
|
|
81
90
|
configurable: true,
|
|
@@ -5,6 +5,9 @@ const base_js_1 = require("./base.cjs");
|
|
|
5
5
|
const ollama_js_1 = require("../util/ollama.cjs");
|
|
6
6
|
const index_js_1 = require("../schema/index.cjs");
|
|
7
7
|
class ChatOllama extends base_js_1.SimpleChatModel {
|
|
8
|
+
static lc_name() {
|
|
9
|
+
return "ChatOllama";
|
|
10
|
+
}
|
|
8
11
|
constructor(fields) {
|
|
9
12
|
super(fields);
|
|
10
13
|
Object.defineProperty(this, "lc_serializable", {
|
|
@@ -7,6 +7,7 @@ export interface OllamaCallOptions extends BaseLanguageModelCallOptions {
|
|
|
7
7
|
}
|
|
8
8
|
export declare class ChatOllama extends SimpleChatModel implements OllamaInput {
|
|
9
9
|
CallOptions: OllamaCallOptions;
|
|
10
|
+
static lc_name(): string;
|
|
10
11
|
lc_serializable: boolean;
|
|
11
12
|
model: string;
|
|
12
13
|
baseUrl: string;
|
|
@@ -2,6 +2,9 @@ import { SimpleChatModel } from "./base.js";
|
|
|
2
2
|
import { createOllamaStream } from "../util/ollama.js";
|
|
3
3
|
import { AIMessageChunk, ChatGenerationChunk, ChatMessage, } from "../schema/index.js";
|
|
4
4
|
export class ChatOllama extends SimpleChatModel {
|
|
5
|
+
static lc_name() {
|
|
6
|
+
return "ChatOllama";
|
|
7
|
+
}
|
|
5
8
|
constructor(fields) {
|
|
6
9
|
super(fields);
|
|
7
10
|
Object.defineProperty(this, "lc_serializable", {
|
|
@@ -5,15 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PromptLayerChatOpenAI = exports.ChatOpenAI = void 0;
|
|
7
7
|
const openai_1 = require("openai");
|
|
8
|
-
const env_js_1 = require("../util/env.cjs");
|
|
9
|
-
const axios_fetch_adapter_js_1 = __importDefault(require("../util/axios-fetch-adapter.cjs"));
|
|
10
|
-
const base_js_1 = require("./base.cjs");
|
|
11
|
-
const index_js_1 = require("../schema/index.cjs");
|
|
12
8
|
const count_tokens_js_1 = require("../base_language/count_tokens.cjs");
|
|
13
|
-
const
|
|
9
|
+
const index_js_1 = require("../schema/index.cjs");
|
|
14
10
|
const convert_to_openai_js_1 = require("../tools/convert_to_openai.cjs");
|
|
11
|
+
const axios_fetch_adapter_js_1 = __importDefault(require("../util/axios-fetch-adapter.cjs"));
|
|
15
12
|
const azure_js_1 = require("../util/azure.cjs");
|
|
13
|
+
const env_js_1 = require("../util/env.cjs");
|
|
14
|
+
const prompt_layer_js_1 = require("../util/prompt-layer.cjs");
|
|
16
15
|
const stream_js_1 = require("../util/stream.cjs");
|
|
16
|
+
const base_js_1 = require("./base.cjs");
|
|
17
17
|
function extractGenericMessageCustomRole(message) {
|
|
18
18
|
if (message.role !== "system" &&
|
|
19
19
|
message.role !== "assistant" &&
|
|
@@ -111,6 +111,9 @@ delta, defaultRole) {
|
|
|
111
111
|
* if not explicitly available on this class.
|
|
112
112
|
*/
|
|
113
113
|
class ChatOpenAI extends base_js_1.BaseChatModel {
|
|
114
|
+
static lc_name() {
|
|
115
|
+
return "ChatOpenAI";
|
|
116
|
+
}
|
|
114
117
|
get callKeys() {
|
|
115
118
|
return [
|
|
116
119
|
...super.callKeys,
|
|
@@ -125,6 +128,7 @@ class ChatOpenAI extends base_js_1.BaseChatModel {
|
|
|
125
128
|
return {
|
|
126
129
|
openAIApiKey: "OPENAI_API_KEY",
|
|
127
130
|
azureOpenAIApiKey: "AZURE_OPENAI_API_KEY",
|
|
131
|
+
organization: "OPENAI_ORGANIZATION",
|
|
128
132
|
};
|
|
129
133
|
}
|
|
130
134
|
get lc_aliases() {
|
|
@@ -261,6 +265,12 @@ class ChatOpenAI extends base_js_1.BaseChatModel {
|
|
|
261
265
|
writable: true,
|
|
262
266
|
value: void 0
|
|
263
267
|
});
|
|
268
|
+
Object.defineProperty(this, "organization", {
|
|
269
|
+
enumerable: true,
|
|
270
|
+
configurable: true,
|
|
271
|
+
writable: true,
|
|
272
|
+
value: void 0
|
|
273
|
+
});
|
|
264
274
|
Object.defineProperty(this, "client", {
|
|
265
275
|
enumerable: true,
|
|
266
276
|
configurable: true,
|
|
@@ -293,6 +303,9 @@ class ChatOpenAI extends base_js_1.BaseChatModel {
|
|
|
293
303
|
this.azureOpenAIBasePath =
|
|
294
304
|
fields?.azureOpenAIBasePath ??
|
|
295
305
|
(0, env_js_1.getEnvironmentVariable)("AZURE_OPENAI_BASE_PATH");
|
|
306
|
+
this.organization =
|
|
307
|
+
fields?.configuration?.organization ??
|
|
308
|
+
(0, env_js_1.getEnvironmentVariable)("OPENAI_ORGANIZATION");
|
|
296
309
|
this.modelName = fields?.modelName ?? this.modelName;
|
|
297
310
|
this.modelKwargs = fields?.modelKwargs ?? {};
|
|
298
311
|
this.timeout = fields?.timeout;
|
|
@@ -319,6 +332,7 @@ class ChatOpenAI extends base_js_1.BaseChatModel {
|
|
|
319
332
|
}
|
|
320
333
|
this.clientConfig = {
|
|
321
334
|
apiKey: this.openAIApiKey,
|
|
335
|
+
organization: this.organization,
|
|
322
336
|
...configuration,
|
|
323
337
|
...fields?.configuration,
|
|
324
338
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChatCompletionFunctions, ConfigurationParameters, CreateChatCompletionRequest, CreateChatCompletionRequestFunctionCall, CreateChatCompletionResponse } from "openai";
|
|
2
|
+
import { CallbackManagerForLLMRun } from "../callbacks/manager.js";
|
|
3
|
+
import { BaseMessage, ChatGenerationChunk, ChatResult } from "../schema/index.js";
|
|
4
|
+
import { StructuredTool } from "../tools/base.js";
|
|
2
5
|
import { AzureOpenAIInput, OpenAICallOptions, OpenAIChatInput } from "../types/openai-types.js";
|
|
3
6
|
import type { StreamingAxiosConfiguration } from "../util/axios-types.js";
|
|
4
7
|
import { BaseChatModel, BaseChatModelParams } from "./base.js";
|
|
5
|
-
|
|
6
|
-
import { CallbackManagerForLLMRun } from "../callbacks/manager.js";
|
|
7
|
-
import { StructuredTool } from "../tools/base.js";
|
|
8
|
-
export { OpenAICallOptions, OpenAIChatInput, AzureOpenAIInput };
|
|
8
|
+
export { AzureOpenAIInput, OpenAICallOptions, OpenAIChatInput };
|
|
9
9
|
interface TokenUsage {
|
|
10
10
|
completionTokens?: number;
|
|
11
11
|
promptTokens?: number;
|
|
@@ -40,6 +40,7 @@ export interface ChatOpenAICallOptions extends OpenAICallOptions {
|
|
|
40
40
|
* if not explicitly available on this class.
|
|
41
41
|
*/
|
|
42
42
|
export declare class ChatOpenAI extends BaseChatModel<ChatOpenAICallOptions> implements OpenAIChatInput, AzureOpenAIInput {
|
|
43
|
+
static lc_name(): string;
|
|
43
44
|
get callKeys(): (keyof ChatOpenAICallOptions)[];
|
|
44
45
|
lc_serializable: boolean;
|
|
45
46
|
get lc_secrets(): {
|
|
@@ -65,6 +66,7 @@ export declare class ChatOpenAI extends BaseChatModel<ChatOpenAICallOptions> imp
|
|
|
65
66
|
azureOpenAIApiInstanceName?: string;
|
|
66
67
|
azureOpenAIApiDeploymentName?: string;
|
|
67
68
|
azureOpenAIBasePath?: string;
|
|
69
|
+
organization?: string;
|
|
68
70
|
private client;
|
|
69
71
|
private clientConfig;
|
|
70
72
|
constructor(fields?: Partial<OpenAIChatInput> & Partial<AzureOpenAIInput> & BaseChatModelParams & {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Configuration, OpenAIApi, } from "openai";
|
|
2
|
-
import { getEnvironmentVariable, isNode } from "../util/env.js";
|
|
3
|
-
import fetchAdapter from "../util/axios-fetch-adapter.js";
|
|
4
|
-
import { BaseChatModel } from "./base.js";
|
|
5
|
-
import { AIMessage, AIMessageChunk, ChatGenerationChunk, ChatMessage, ChatMessageChunk, FunctionMessageChunk, HumanMessage, HumanMessageChunk, SystemMessage, SystemMessageChunk, } from "../schema/index.js";
|
|
6
2
|
import { getModelNameForTiktoken } from "../base_language/count_tokens.js";
|
|
7
|
-
import {
|
|
3
|
+
import { AIMessage, AIMessageChunk, ChatGenerationChunk, ChatMessage, ChatMessageChunk, FunctionMessageChunk, HumanMessage, HumanMessageChunk, SystemMessage, SystemMessageChunk, } from "../schema/index.js";
|
|
8
4
|
import { formatToOpenAIFunction } from "../tools/convert_to_openai.js";
|
|
5
|
+
import fetchAdapter from "../util/axios-fetch-adapter.js";
|
|
9
6
|
import { getEndpoint } from "../util/azure.js";
|
|
7
|
+
import { getEnvironmentVariable, isNode } from "../util/env.js";
|
|
8
|
+
import { promptLayerTrackRequest } from "../util/prompt-layer.js";
|
|
10
9
|
import { readableStreamToAsyncIterable } from "../util/stream.js";
|
|
10
|
+
import { BaseChatModel } from "./base.js";
|
|
11
11
|
function extractGenericMessageCustomRole(message) {
|
|
12
12
|
if (message.role !== "system" &&
|
|
13
13
|
message.role !== "assistant" &&
|
|
@@ -105,6 +105,9 @@ delta, defaultRole) {
|
|
|
105
105
|
* if not explicitly available on this class.
|
|
106
106
|
*/
|
|
107
107
|
export class ChatOpenAI extends BaseChatModel {
|
|
108
|
+
static lc_name() {
|
|
109
|
+
return "ChatOpenAI";
|
|
110
|
+
}
|
|
108
111
|
get callKeys() {
|
|
109
112
|
return [
|
|
110
113
|
...super.callKeys,
|
|
@@ -119,6 +122,7 @@ export class ChatOpenAI extends BaseChatModel {
|
|
|
119
122
|
return {
|
|
120
123
|
openAIApiKey: "OPENAI_API_KEY",
|
|
121
124
|
azureOpenAIApiKey: "AZURE_OPENAI_API_KEY",
|
|
125
|
+
organization: "OPENAI_ORGANIZATION",
|
|
122
126
|
};
|
|
123
127
|
}
|
|
124
128
|
get lc_aliases() {
|
|
@@ -255,6 +259,12 @@ export class ChatOpenAI extends BaseChatModel {
|
|
|
255
259
|
writable: true,
|
|
256
260
|
value: void 0
|
|
257
261
|
});
|
|
262
|
+
Object.defineProperty(this, "organization", {
|
|
263
|
+
enumerable: true,
|
|
264
|
+
configurable: true,
|
|
265
|
+
writable: true,
|
|
266
|
+
value: void 0
|
|
267
|
+
});
|
|
258
268
|
Object.defineProperty(this, "client", {
|
|
259
269
|
enumerable: true,
|
|
260
270
|
configurable: true,
|
|
@@ -287,6 +297,9 @@ export class ChatOpenAI extends BaseChatModel {
|
|
|
287
297
|
this.azureOpenAIBasePath =
|
|
288
298
|
fields?.azureOpenAIBasePath ??
|
|
289
299
|
getEnvironmentVariable("AZURE_OPENAI_BASE_PATH");
|
|
300
|
+
this.organization =
|
|
301
|
+
fields?.configuration?.organization ??
|
|
302
|
+
getEnvironmentVariable("OPENAI_ORGANIZATION");
|
|
290
303
|
this.modelName = fields?.modelName ?? this.modelName;
|
|
291
304
|
this.modelKwargs = fields?.modelKwargs ?? {};
|
|
292
305
|
this.timeout = fields?.timeout;
|
|
@@ -313,6 +326,7 @@ export class ChatOpenAI extends BaseChatModel {
|
|
|
313
326
|
}
|
|
314
327
|
this.clientConfig = {
|
|
315
328
|
apiKey: this.openAIApiKey,
|
|
329
|
+
organization: this.organization,
|
|
316
330
|
...configuration,
|
|
317
331
|
...fields?.configuration,
|
|
318
332
|
};
|