Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
import gradio as gr
|
2 |
-
from
|
|
|
3 |
from langchain.agents import AgentType
|
4 |
-
from
|
5 |
import os
|
6 |
|
7 |
# Set your OpenAI API key (ensure to store it securely in Hugging Face Spaces environment variables)
|
@@ -14,7 +15,7 @@ _ = load_dotenv()
|
|
14 |
|
15 |
# Define the LLM model
|
16 |
llm_model = "gpt-3.5-turbo"
|
17 |
-
llm = ChatOpenAI(temperature=0, model=llm_model)
|
18 |
|
19 |
# Load tools
|
20 |
tools = load_tools(["llm-math", "wikipedia"], llm=llm)
|
|
|
1 |
import gradio as gr
|
2 |
+
from langchain_community.agent_toolkits.load_tools import load_tools # Updated import
|
3 |
+
from langchain.agents import initialize_agent
|
4 |
from langchain.agents import AgentType
|
5 |
+
from langchain_openai import ChatOpenAI # Updated import
|
6 |
import os
|
7 |
|
8 |
# Set your OpenAI API key (ensure to store it securely in Hugging Face Spaces environment variables)
|
|
|
15 |
|
16 |
# Define the LLM model
|
17 |
llm_model = "gpt-3.5-turbo"
|
18 |
+
llm = ChatOpenAI(temperature=0, model=llm_model, openai_api_key=os.getenv('OPENAI_API_KEY')) # Ensure to pass the API key
|
19 |
|
20 |
# Load tools
|
21 |
tools = load_tools(["llm-math", "wikipedia"], llm=llm)
|