fix: Add correct AsyncGenerator class. Resolve streaming error in stream_agent method
Browse files- .gitignore +3 -1
- chainlit.md +14 -0
- src/axiom/agent.py +4 -4
.gitignore
CHANGED
|
@@ -33,4 +33,6 @@ ENV/
|
|
| 33 |
*.swo
|
| 34 |
|
| 35 |
# Project specific
|
| 36 |
-
test_axiom/
|
|
|
|
|
|
|
|
|
| 33 |
*.swo
|
| 34 |
|
| 35 |
# Project specific
|
| 36 |
+
test_axiom/
|
| 37 |
+
.chainlit/
|
| 38 |
+
.files/
|
chainlit.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Welcome to Chainlit! 🚀🤖
|
| 2 |
+
|
| 3 |
+
Hi there, Developer! 👋 We're excited to have you on board. Chainlit is a powerful tool designed to help you prototype, debug and share applications built on top of LLMs.
|
| 4 |
+
|
| 5 |
+
## Useful Links 🔗
|
| 6 |
+
|
| 7 |
+
- **Documentation:** Get started with our comprehensive [Chainlit Documentation](https://docs.chainlit.io) 📚
|
| 8 |
+
- **Discord Community:** Join our friendly [Chainlit Discord](https://discord.gg/k73SQ3FyUh) to ask questions, share your projects, and connect with other developers! 💬
|
| 9 |
+
|
| 10 |
+
We can't wait to see what you create with Chainlit! Happy coding! 💻😊
|
| 11 |
+
|
| 12 |
+
## Welcome screen
|
| 13 |
+
|
| 14 |
+
To modify the welcome screen, edit the `chainlit.md` file at the root of your project. If you do not want a welcome screen, just leave this file empty.
|
src/axiom/agent.py
CHANGED
|
@@ -13,7 +13,7 @@ from agents.mcp import MCPServer
|
|
| 13 |
from .config import settings
|
| 14 |
from .prompts import AXIOM_AGENT_PROMPT
|
| 15 |
|
| 16 |
-
from
|
| 17 |
|
| 18 |
class AxiomAgent:
|
| 19 |
def __init__(
|
|
@@ -29,8 +29,8 @@ class AxiomAgent:
|
|
| 29 |
self.agent = Agent(
|
| 30 |
name="Axiom 2.0",
|
| 31 |
instructions=AXIOM_AGENT_PROMPT,
|
| 32 |
-
mcp_servers=mcp_servers,
|
| 33 |
-
tools=tools,
|
| 34 |
)
|
| 35 |
|
| 36 |
def _get_model_config(self):
|
|
@@ -59,7 +59,7 @@ class AxiomAgent:
|
|
| 59 |
async def stream_agent(self, input: str | list[dict[str, str]]) -> AsyncGenerator:
|
| 60 |
config = self._get_model_config()
|
| 61 |
|
| 62 |
-
result =
|
| 63 |
starting_agent=self.agent,
|
| 64 |
input=input,
|
| 65 |
run_config=config
|
|
|
|
| 13 |
from .config import settings
|
| 14 |
from .prompts import AXIOM_AGENT_PROMPT
|
| 15 |
|
| 16 |
+
from typing_extensions import AsyncGenerator
|
| 17 |
|
| 18 |
class AxiomAgent:
|
| 19 |
def __init__(
|
|
|
|
| 29 |
self.agent = Agent(
|
| 30 |
name="Axiom 2.0",
|
| 31 |
instructions=AXIOM_AGENT_PROMPT,
|
| 32 |
+
mcp_servers=mcp_servers if mcp_servers is not None else [],
|
| 33 |
+
tools=tools if tools is not None else [],
|
| 34 |
)
|
| 35 |
|
| 36 |
def _get_model_config(self):
|
|
|
|
| 59 |
async def stream_agent(self, input: str | list[dict[str, str]]) -> AsyncGenerator:
|
| 60 |
config = self._get_model_config()
|
| 61 |
|
| 62 |
+
result = Runner.run_streamed(
|
| 63 |
starting_agent=self.agent,
|
| 64 |
input=input,
|
| 65 |
run_config=config
|