Spaces:
Runtime error
Runtime error
Alex Arvanitidis
commited on
Commit
·
a46e984
1
Parent(s):
6b06e0a
fix: try using tuples for message types
Browse files- Gradio_UI.py +4 -1
- app.py +4 -3
Gradio_UI.py
CHANGED
@@ -125,6 +125,7 @@ class GradioAgentChatPack(BaseLlamaPack):
|
|
125 |
)
|
126 |
with gr.Row():
|
127 |
chat_window = gr.Chatbot(
|
|
|
128 |
label="Message History",
|
129 |
scale=3,
|
130 |
)
|
@@ -145,4 +146,6 @@ class GradioAgentChatPack(BaseLlamaPack):
|
|
145 |
)
|
146 |
clear.click(self._reset_chat, None, [message, chat_window, console])
|
147 |
|
148 |
-
demo.launch(
|
|
|
|
|
|
125 |
)
|
126 |
with gr.Row():
|
127 |
chat_window = gr.Chatbot(
|
128 |
+
type='tuples',
|
129 |
label="Message History",
|
130 |
scale=3,
|
131 |
)
|
|
|
146 |
)
|
147 |
clear.click(self._reset_chat, None, [message, chat_window, console])
|
148 |
|
149 |
+
demo.launch(server_name="0.0.0.0", server_port=8080)
|
150 |
+
|
151 |
+
# demo.launch(debug=True, share=True, **kwargs)
|
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import os
|
2 |
|
3 |
from jaqpot_python_sdk.jaqpot_api_client import JaqpotApiClient
|
4 |
-
from llama_index.core.agent import AgentRunner
|
5 |
from llama_index.core.tools import FunctionTool
|
6 |
from llama_index.llms.openai_like import OpenAILike
|
7 |
from pubchempy import get_compounds
|
@@ -364,9 +364,10 @@ def qsartoolbox_get_property_value_tool(smiles:str, qsartoolbox_qsar_model: str)
|
|
364 |
llm = OpenAILike(model=os.environ["LLM_MODEL_ID"], api_base=os.environ["LLM_API_BASE"], api_key='None')
|
365 |
|
366 |
# initialize agent
|
367 |
-
agent =
|
368 |
[FunctionTool.from_defaults(retrieve_smiles_tool), FunctionTool.from_defaults(qsartoolbox_get_property_value_tool)],
|
369 |
-
llm=llm
|
|
|
370 |
)
|
371 |
|
372 |
GradioAgentChatPack(agent).run()
|
|
|
1 |
import os
|
2 |
|
3 |
from jaqpot_python_sdk.jaqpot_api_client import JaqpotApiClient
|
4 |
+
from llama_index.core.agent import AgentRunner, ReActAgent
|
5 |
from llama_index.core.tools import FunctionTool
|
6 |
from llama_index.llms.openai_like import OpenAILike
|
7 |
from pubchempy import get_compounds
|
|
|
364 |
llm = OpenAILike(model=os.environ["LLM_MODEL_ID"], api_base=os.environ["LLM_API_BASE"], api_key='None')
|
365 |
|
366 |
# initialize agent
|
367 |
+
agent = ReActAgent(
|
368 |
[FunctionTool.from_defaults(retrieve_smiles_tool), FunctionTool.from_defaults(qsartoolbox_get_property_value_tool)],
|
369 |
+
llm=llm,
|
370 |
+
memory=None
|
371 |
)
|
372 |
|
373 |
GradioAgentChatPack(agent).run()
|