Spaces:
Runtime error
Runtime error
refactored some code
Browse files- mixtral_agent.py +16 -2
mixtral_agent.py
CHANGED
@@ -13,12 +13,21 @@ from langchain.agents.output_parsers import (
|
|
13 |
ReActJsonSingleInputOutputParser,
|
14 |
)
|
15 |
from langchain.tools.render import render_text_description
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
# supports many more optional parameters. Hover on your `ChatOllama(...)`
|
18 |
# class to view the latest available supported parameters
|
19 |
llm = ChatOllama(
|
20 |
model="mistral",
|
21 |
-
base_url=
|
22 |
)
|
23 |
prompt = ChatPromptTemplate.from_template("Tell me a short joke about {topic}")
|
24 |
|
@@ -72,7 +81,12 @@ agent = (
|
|
72 |
)
|
73 |
|
74 |
# instantiate AgentExecutor
|
75 |
-
agent_executor = AgentExecutor(
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
# agent_executor.invoke(
|
78 |
# {
|
|
|
13 |
ReActJsonSingleInputOutputParser,
|
14 |
)
|
15 |
from langchain.tools.render import render_text_description
|
16 |
+
import os
|
17 |
+
|
18 |
+
import dotenv
|
19 |
+
|
20 |
+
dotenv.load_dotenv()
|
21 |
+
|
22 |
+
|
23 |
+
OLLMA_BASE_URL = os.getenv("OLLMA_BASE_URL")
|
24 |
+
|
25 |
|
26 |
# supports many more optional parameters. Hover on your `ChatOllama(...)`
|
27 |
# class to view the latest available supported parameters
|
28 |
llm = ChatOllama(
|
29 |
model="mistral",
|
30 |
+
base_url= OLLMA_BASE_URL
|
31 |
)
|
32 |
prompt = ChatPromptTemplate.from_template("Tell me a short joke about {topic}")
|
33 |
|
|
|
81 |
)
|
82 |
|
83 |
# instantiate AgentExecutor
|
84 |
+
agent_executor = AgentExecutor(
|
85 |
+
agent=agent,
|
86 |
+
tools=tools,
|
87 |
+
verbose=True,
|
88 |
+
handle_parsing_errors=True
|
89 |
+
)
|
90 |
|
91 |
# agent_executor.invoke(
|
92 |
# {
|