Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for using nested Agents, languse upgrade needed #899

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
- Update langfuse to fix errors
- Improve logger with extra data (datetime, filepath)
- Add return_direct to saml schema for SuperagentAgentTool
heresandyboy committed Mar 15, 2024
commit 3bf9a1800e8ddca4e44c7829f5aa134ee4938aa5
5 changes: 3 additions & 2 deletions libs/superagent/app/api/workflow_configs/saml_schema.py
Original file line number Diff line number Diff line change
@@ -104,7 +104,8 @@ class Assistant(BaseModel):
# ~~~Agents~~~
class SuperagentAgent(Assistant):
tools: Optional[Tools]
data: Optional[Data] = Field(description="Deprecated! Use `superrag` instead.")
data: Optional[Data] = Field(
description="Deprecated! Use `superrag` instead.")
superrag: Optional[Superrag]


@@ -122,7 +123,7 @@ class BaseAgentToolModel(BaseModel):


class SuperagentAgentTool(BaseAgentToolModel, SuperagentAgent):
pass
return_direct: Optional[bool] = False


class OpenAIAgentTool(BaseAgentToolModel, OpenAIAgent):
14 changes: 9 additions & 5 deletions libs/superagent/app/main.py
Original file line number Diff line number Diff line change
@@ -9,9 +9,10 @@
from app.routers import router
from app.utils.prisma import prisma

# Create a color formatter
# Create a color formatter including file name and line number
formatter = colorlog.ColoredFormatter(
"%(log_color)s%(levelname)s: %(message)s",
"%(log_color)s%(asctime)s - %(levelname)s - %(pathname)s:%(lineno)d:\n%(message)s",
datefmt='%Y-%m-%d %H:%M:%S',
log_colors={
"DEBUG": "cyan",
"INFO": "green",
@@ -21,17 +22,20 @@
},
secondary_log_colors={},
style="%",
) # Create a console handler and set the formatter
)
console_handler = logging.StreamHandler()
console_handler.setFormatter(formatter)

# Update basicConfig format to include file name and line number
logging.basicConfig(
level=logging.INFO,
format="%(levelname)s: %(message)s",
format="%(asctime)s - %(levelname)s - %(pathname)s:%(lineno)d:\n%(message)s",
handlers=[console_handler],
force=True,
)

logger = logging.getLogger("main")

app = FastAPI(
title="Superagent",
docs_url="/",
@@ -54,7 +58,7 @@ async def add_process_time_header(request: Request, call_next):
start_time = time.time()
response = await call_next(request)
process_time = time.time() - start_time
print(f"Total request time: {process_time} secs")
logger.debug(f"Total request time: {process_time} secs")
return response


86 changes: 14 additions & 72 deletions libs/superagent/poetry.lock