Spaces:
Runtime error
Runtime error
Commit
•
1e459bb
1
Parent(s):
d74ccb5
Add application file
Browse files
app.py
CHANGED
@@ -11,9 +11,13 @@ import gradio as gr
|
|
11 |
import boto3
|
12 |
|
13 |
|
14 |
-
from langchain import OpenAI,
|
|
|
|
|
|
|
|
|
15 |
from langchain.agents import AgentType
|
16 |
-
from langchain.agents.tools import SQLAgent
|
17 |
from langchain.memory import ReadOnlySharedMemory
|
18 |
|
19 |
|
@@ -61,7 +65,6 @@ llm = OpenAI(temperature=0, verbose=True, openai_api_key=openai_api_key)
|
|
61 |
# iface.launch(share=True)
|
62 |
|
63 |
# Load the language model and tools
|
64 |
-
llm = OpenAI()
|
65 |
tools = load_tools(["llama_index"], llm=llm)
|
66 |
|
67 |
# Define the agent
|
@@ -74,7 +77,7 @@ def chatbot(user_name):
|
|
74 |
# Define the memory
|
75 |
memory = ReadOnlySharedMemory()
|
76 |
# Define the SQL agent
|
77 |
-
sql_agent = SQLAgent(database="my_database.db", table="my_table")
|
78 |
# Loop until the user ends the conversation
|
79 |
|
80 |
while True:
|
|
|
11 |
import boto3
|
12 |
|
13 |
|
14 |
+
from langchain import OpenAI, initialize_agent
|
15 |
+
|
16 |
+
from llama_index.tools import load_tools
|
17 |
+
|
18 |
+
# load_tools
|
19 |
from langchain.agents import AgentType
|
20 |
+
# from langchain.agents.tools import SQLAgent
|
21 |
from langchain.memory import ReadOnlySharedMemory
|
22 |
|
23 |
|
|
|
65 |
# iface.launch(share=True)
|
66 |
|
67 |
# Load the language model and tools
|
|
|
68 |
tools = load_tools(["llama_index"], llm=llm)
|
69 |
|
70 |
# Define the agent
|
|
|
77 |
# Define the memory
|
78 |
memory = ReadOnlySharedMemory()
|
79 |
# Define the SQL agent
|
80 |
+
# sql_agent = SQLAgent(database="my_database.db", table="my_table")
|
81 |
# Loop until the user ends the conversation
|
82 |
|
83 |
while True:
|