diff --git a/src/backend/langflow/components/agents/ZeroShotAgent.py b/src/backend/langflow/components/agents/ZeroShotAgent.py index bdc402059..2ec37fa7d 100644 --- a/src/backend/langflow/components/agents/ZeroShotAgent.py +++ b/src/backend/langflow/components/agents/ZeroShotAgent.py @@ -3,9 +3,7 @@ from langflow import CustomComponent from langchain.agents import ZeroShotAgent from langchain_core.tools import BaseTool from typing import List, Optional -from langflow.field_typing import ( - BaseLanguageModel, -) +from langflow.components.chains.LLMChain import LLMChain class ZeroShotAgentComponent(CustomComponent): display_name = "ZeroShotAgent" @@ -21,9 +19,9 @@ class ZeroShotAgentComponent(CustomComponent): def build( self, - llm: BaseLanguageModel, + llm: LLMChain, tools: List[BaseTool], prefix: Optional[str] = "Answer the following questions as best you can. You have access to the following tools:", suffix: Optional[str] = "Begin!\n\nQuestion: {input}\nThought:{agent_scratchpad}", ) -> ZeroShotAgent: - return ZeroShotAgent(llm=llm, tools=tools, prefix=prefix, suffix=suffix) + return ZeroShotAgent(llm_chain=llm, tools=tools, prefix=prefix, suffix=suffix) diff --git a/src/backend/langflow/components/llms/OpenAI.py b/src/backend/langflow/components/llms/OpenAI.py index 5c8d38730..15091f6e7 100644 --- a/src/backend/langflow/components/llms/OpenAI.py +++ b/src/backend/langflow/components/llms/OpenAI.py @@ -42,10 +42,12 @@ class OpenAIComponent(CustomComponent): max_tokens: Optional[int] = 256, model_kwargs: Optional[Dict] = None, model_name: Optional[str] = "text-davinci-003", - openai_api_base: Optional[str] = "https://api.openai.com/v1", + openai_api_base: Optional[str] = "", openai_api_key: str = "", temperature: Optional[float] = 0.7, ) -> OpenAI: + if(not openai_api_base): + openai_api_base = "https://api.openai.com/v1" return OpenAI( max_tokens=max_tokens, model_kwargs=model_kwargs or {},