diff --git a/langchain/src/chains/openai_moderation.ts b/langchain/src/chains/openai_moderation.ts index 5497bf8449ae..f6f4194d9650 100644 --- a/langchain/src/chains/openai_moderation.ts +++ b/langchain/src/chains/openai_moderation.ts @@ -87,7 +87,7 @@ export class OpenAIModerationChain this.throwError = fields?.throwError ?? false; this.openAIApiKey = fields?.apiKey ?? - fields?.openAIApiKey ?? + fields?.openAIApiKey ?? getEnvironmentVariable("OPENAI_API_KEY"); if (!this.openAIApiKey) { diff --git a/libs/langchain-azure-openai/src/chat_models.ts b/libs/langchain-azure-openai/src/chat_models.ts index 79233bf1a2bf..9b899d3c7889 100644 --- a/libs/langchain-azure-openai/src/chat_models.ts +++ b/libs/langchain-azure-openai/src/chat_models.ts @@ -163,6 +163,7 @@ export interface ChatOpenAICallOptions seed?: number; } +/** @deprecated Import from "@langchain/openai" instead. */ export class AzureChatOpenAI extends BaseChatModel implements OpenAIChatInput, AzureOpenAIInput @@ -268,7 +269,7 @@ export class AzureChatOpenAI const openAiApiKey = fields?.apiKey ?? - fields?.openAIApiKey ?? + fields?.openAIApiKey ?? getEnvironmentVariable("OPENAI_API_KEY"); this.azureOpenAIApiKey = diff --git a/libs/langchain-azure-openai/src/embeddings.ts b/libs/langchain-azure-openai/src/embeddings.ts index 85a0546b7e17..4289d8f66192 100644 --- a/libs/langchain-azure-openai/src/embeddings.ts +++ b/libs/langchain-azure-openai/src/embeddings.ts @@ -15,6 +15,7 @@ import { chunkArray } from "@langchain/core/utils/chunk_array"; import { AzureOpenAIInput, AzureOpenAIEmbeddingsParams } from "./types.js"; import { USER_AGENT_PREFIX } from "./constants.js"; +/** @deprecated Import from "@langchain/openai" instead. */ export class AzureOpenAIEmbeddings extends Embeddings implements AzureOpenAIEmbeddingsParams, AzureOpenAIInput @@ -63,7 +64,7 @@ export class AzureOpenAIEmbeddings const openAiApiKey = fields?.apiKey ?? - fields?.openAIApiKey ?? + fields?.openAIApiKey ?? getEnvironmentVariable("OPENAI_API_KEY"); this.azureOpenAIApiKey = diff --git a/libs/langchain-azure-openai/src/llms.ts b/libs/langchain-azure-openai/src/llms.ts index c08b526ede4f..998705449459 100644 --- a/libs/langchain-azure-openai/src/llms.ts +++ b/libs/langchain-azure-openai/src/llms.ts @@ -33,6 +33,7 @@ export interface TokenUsage { totalTokens?: number; } +/** @deprecated Import from "@langchain/openai" instead. */ export class AzureOpenAI< CallOptions extends OpenAICallOptions = OpenAICallOptions > @@ -136,7 +137,7 @@ export class AzureOpenAI< const openAiApiKey = fields?.apiKey ?? - fields?.openAIApiKey ?? + fields?.openAIApiKey ?? getEnvironmentVariable("OPENAI_API_KEY"); this.azureOpenAIApiKey = diff --git a/libs/langchain-openai/src/legacy.ts b/libs/langchain-openai/src/legacy.ts index 3bea08506152..16e0452af2e2 100644 --- a/libs/langchain-openai/src/legacy.ts +++ b/libs/langchain-openai/src/legacy.ts @@ -158,7 +158,7 @@ export class OpenAIChat this.openAIApiKey = fields?.apiKey ?? - fields?.openAIApiKey ?? + fields?.openAIApiKey ?? getEnvironmentVariable("OPENAI_API_KEY"); this.azureOpenAIApiKey =