From 98d32f31c6857e21761deabcca78e0dae3124e1c Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Tue, 11 Apr 2023 16:20:46 +0100 Subject: [PATCH] Remove unnecessary `protected` keyword in a few places (#743) --- langchain/src/agents/agent_toolkits/zapier/zapier.ts | 4 ---- langchain/src/base_language/index.ts | 4 ++-- langchain/src/chat_models/base.ts | 4 ++-- langchain/src/embeddings/base.ts | 2 +- langchain/src/retrievers/remote/base.ts | 2 +- test-exports-vercel/src/pages/api/hello-edge.ts | 2 ++ 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/langchain/src/agents/agent_toolkits/zapier/zapier.ts b/langchain/src/agents/agent_toolkits/zapier/zapier.ts index 6fa8b9c737ef..65dd685607ec 100644 --- a/langchain/src/agents/agent_toolkits/zapier/zapier.ts +++ b/langchain/src/agents/agent_toolkits/zapier/zapier.ts @@ -5,10 +5,6 @@ import { ZapierNLARunAction, ZapierNLAWrapper } from "../../../tools/zapier.js"; export class ZapierToolKit extends Toolkit { tools: Tool[] = []; - protected constructor() { - super(); - } - static async fromZapierNLAWrapper( zapierNLAWrapper: ZapierNLAWrapper ): Promise { diff --git a/langchain/src/base_language/index.ts b/langchain/src/base_language/index.ts index f8c5676a082d..1dcd30bb9667 100644 --- a/langchain/src/base_language/index.ts +++ b/langchain/src/base_language/index.ts @@ -37,9 +37,9 @@ export abstract class BaseLanguageModel implements BaseLanguageModelParams { * The async caller should be used by subclasses to make any async calls, * which will thus benefit from the concurrency and retry logic. */ - protected caller: AsyncCaller; + caller: AsyncCaller; - protected constructor(params: BaseLanguageModelParams) { + constructor(params: BaseLanguageModelParams) { this.verbose = params.verbose ?? (params.callbackManager ? true : getVerbosity()); this.callbackManager = params.callbackManager ?? getCallbackManager(); diff --git a/langchain/src/chat_models/base.ts b/langchain/src/chat_models/base.ts index 4aa0a8435bb2..181cbf5c58c3 100644 --- a/langchain/src/chat_models/base.ts +++ b/langchain/src/chat_models/base.ts @@ -28,8 +28,8 @@ export type SerializedLLM = { export type BaseChatModelParams = BaseLanguageModelParams; export abstract class BaseChatModel extends BaseLanguageModel { - protected constructor({ ...rest }: BaseChatModelParams) { - super(rest); + constructor(fields: BaseChatModelParams) { + super(fields); } abstract _combineLLMOutput?( diff --git a/langchain/src/embeddings/base.ts b/langchain/src/embeddings/base.ts index b5beff1fe7a2..ebb8553b2b68 100644 --- a/langchain/src/embeddings/base.ts +++ b/langchain/src/embeddings/base.ts @@ -7,7 +7,7 @@ export abstract class Embeddings { * The async caller should be used by subclasses to make any async calls, * which will thus benefit from the concurrency and retry logic. */ - protected caller: AsyncCaller; + caller: AsyncCaller; constructor(params: EmbeddingsParams) { this.caller = new AsyncCaller(params ?? {}); diff --git a/langchain/src/retrievers/remote/base.ts b/langchain/src/retrievers/remote/base.ts index 1dd100cdf1c9..d52034298243 100644 --- a/langchain/src/retrievers/remote/base.ts +++ b/langchain/src/retrievers/remote/base.ts @@ -32,7 +32,7 @@ export abstract class RemoteRetriever asyncCaller: AsyncCaller; - protected constructor({ url, auth, ...rest }: RemoteRetrieverParams) { + constructor({ url, auth, ...rest }: RemoteRetrieverParams) { super(); this.url = url; this.auth = auth; diff --git a/test-exports-vercel/src/pages/api/hello-edge.ts b/test-exports-vercel/src/pages/api/hello-edge.ts index ce90a527c001..c36dc18c4bdb 100644 --- a/test-exports-vercel/src/pages/api/hello-edge.ts +++ b/test-exports-vercel/src/pages/api/hello-edge.ts @@ -13,6 +13,7 @@ import { import { OpenAI } from "langchain/llms/openai"; import { OpenAIEmbeddings } from "langchain/embeddings/openai"; import { CallbackManager } from "langchain/callbacks"; +import { ChatAgent } from "langchain/agents"; import { NextRequest, NextResponse } from "next/server"; @@ -26,6 +27,7 @@ export default async function handler(req: NextRequest) { const emb = new OpenAIEmbeddings({ openAIApiKey: process.env.OPENAI_API_KEY, }); + const agent = ChatAgent.fromLLMAndTools(new ChatOpenAI(), []); // Set up a streaming LLM const encoder = new TextEncoder();