Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from langchain.agents import
|
| 3 |
from langchain.chat_models import ChatOpenAI
|
| 4 |
from langchain.memory import ConversationBufferMemory
|
| 5 |
from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
|
| 6 |
-
from langchain.agents import AgentExecutor
|
| 7 |
from langchain.tools import Tool
|
| 8 |
|
| 9 |
# Define the tool
|
|
@@ -19,9 +18,11 @@ def search_wikipedia(query: str) -> str:
|
|
| 19 |
return "Wikipedia search results for: " + query
|
| 20 |
|
| 21 |
# Add the new tool to the list of available tools
|
| 22 |
-
tools = [
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
| 25 |
|
| 26 |
# Define the cbfs class for handling the agent
|
| 27 |
class cbfs:
|
|
@@ -62,3 +63,4 @@ with gr.Blocks() as demo:
|
|
| 62 |
inp.submit(process_query, inputs=inp, outputs=output)
|
| 63 |
|
| 64 |
demo.launch(share=True)
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from langchain.agents import AgentExecutor
|
| 3 |
from langchain.chat_models import ChatOpenAI
|
| 4 |
from langchain.memory import ConversationBufferMemory
|
| 5 |
from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
|
|
|
|
| 6 |
from langchain.tools import Tool
|
| 7 |
|
| 8 |
# Define the tool
|
|
|
|
| 18 |
return "Wikipedia search results for: " + query
|
| 19 |
|
| 20 |
# Add the new tool to the list of available tools
|
| 21 |
+
tools = [
|
| 22 |
+
Tool(name="Temperature", func=get_current_temperature, description="Get current temperature"),
|
| 23 |
+
Tool(name="Search Wikipedia", func=search_wikipedia, description="Search Wikipedia"),
|
| 24 |
+
Tool(name="Create Your Own", func=create_your_own, description="Custom tool for processing input")
|
| 25 |
+
]
|
| 26 |
|
| 27 |
# Define the cbfs class for handling the agent
|
| 28 |
class cbfs:
|
|
|
|
| 63 |
inp.submit(process_query, inputs=inp, outputs=output)
|
| 64 |
|
| 65 |
demo.launch(share=True)
|
| 66 |
+
|