mirror of
https://github.com/Shubhamsaboo/awesome-llm-apps.git
synced 2026-04-28 22:28:59 -05:00
refactor: Update AI agents to use RunOutput and specify agno version
- Changed response type to `RunOutput` in both the 3D pygame and Tic Tac Toe agents for improved type safety. - Updated the `agno` package version in requirements.txt to ensure compatibility.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import streamlit as st
|
||||
from openai import OpenAI
|
||||
from agno.agent import Agent as AgnoAgent
|
||||
from agno.run.agent import RunOutput
|
||||
from agno.models.openai import OpenAIChat as AgnoOpenAIChat
|
||||
from langchain_openai import ChatOpenAI
|
||||
import asyncio
|
||||
@@ -87,13 +88,13 @@ if generate_code_btn and query:
|
||||
with st.expander("R1's Reasoning"):
|
||||
st.write(reasoning_content)
|
||||
|
||||
# Initialize Claude agent (using PhiAgent)
|
||||
# Initialize OpenAI agent
|
||||
openai_agent = AgnoAgent(
|
||||
model=AgnoOpenAIChat(
|
||||
id="gpt-4o",
|
||||
api_key=st.session_state.api_keys["openai"]
|
||||
),
|
||||
show_tool_calls=True,
|
||||
debug_mode=True,
|
||||
markdown=True
|
||||
)
|
||||
|
||||
@@ -103,7 +104,7 @@ if generate_code_btn and query:
|
||||
{reasoning_content}"""
|
||||
|
||||
with st.spinner("Extracting code..."):
|
||||
code_response = openai_agent.run(extraction_prompt)
|
||||
code_response: RunOutput = openai_agent.run(extraction_prompt)
|
||||
extracted_code = code_response.content
|
||||
|
||||
# Store the generated code in session state
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
agno
|
||||
agno>=2.2.10
|
||||
langchain-openai
|
||||
browser-use
|
||||
streamlit
|
||||
@@ -7,6 +7,7 @@ import os
|
||||
load_dotenv()
|
||||
|
||||
from agents import get_tic_tac_toe_players
|
||||
from agno.run.agent import RunOutput
|
||||
from agno.utils.log import logger
|
||||
from utils import (
|
||||
CUSTOM_CSS,
|
||||
@@ -218,7 +219,7 @@ def main():
|
||||
if current_player == "X"
|
||||
else st.session_state.player_o
|
||||
)
|
||||
response = current_agent.run(
|
||||
response: RunOutput = current_agent.run(
|
||||
f"""\
|
||||
Current board state:\n{st.session_state.game_board.get_board_state()}\n
|
||||
Available valid moves (row, col): {valid_moves}\n
|
||||
@@ -263,7 +264,7 @@ Respond with ONLY two numbers for row and column, e.g. "1 2".""",
|
||||
st.rerun()
|
||||
else:
|
||||
logger.error(f"Invalid move attempt: {message}")
|
||||
response = current_agent.run(
|
||||
response: RunOutput = current_agent.run(
|
||||
f"""\
|
||||
Invalid move: {message}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# ./generate_requirements.sh
|
||||
agno==1.1.6
|
||||
agno>=2.2.10
|
||||
# via -r cookbook/examples/apps/tic_tac_toe/requirements.in
|
||||
altair==5.5.0
|
||||
# via streamlit
|
||||
|
||||
Reference in New Issue
Block a user