Skip to content

Commit 6f1370b

Browse files
committed
cr 2
1 parent acadb1b commit 6f1370b

6 files changed

Lines changed: 34 additions & 50 deletions

File tree

agents/base/crewai_websearch_agent/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ Send a test request:
177177
Non-streaming
178178

179179
```bash
180-
curl -X POST https://crewai-websearch-agent-tguzik-agents.apps.rosa.ai-eng-gpu.socc.p3.openshiftapps.com/chat/completions \
180+
curl -X POST https://<YOUR_ROUTE_URL>/chat/completions \
181181
-H "Content-Type: application/json" \
182182
-d '{"messages": [{"role": "user", "content": "What is the best cluster hosting service?"}], "stream": false}'
183183
```

agents/base/langgraph_react_agent/main.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,7 @@ class ChatCompletionResponse(BaseModel):
8989
)
9090
model: str = Field(..., description="The model used for the chat completion.")
9191
choices: list[Choice] = Field(..., description="A list of chat completion choices.")
92-
context: list[dict] | None = Field(
93-
None,
94-
description="Full conversation context including tool calls and results.",
95-
)
92+
9693
usage: dict | None = Field(
9794
None, description="Usage statistics for the completion request."
9895
)

agents/base/llamaindex_websearch_agent/main.py

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,7 @@ class ChatCompletionResponse(BaseModel):
8888
)
8989
model: str = Field(..., description="The model used for the chat completion.")
9090
choices: list[Choice] = Field(..., description="A list of chat completion choices.")
91-
context: list[dict] | None = Field(
92-
None,
93-
description="Full conversation context including tool calls and results.",
94-
)
91+
9592
usage: dict | None = Field(
9693
None, description="Usage statistics for the completion request."
9794
)
@@ -336,35 +333,35 @@ async def event_generator():
336333

337334
async for event in handler.stream_events():
338335
if isinstance(event, ToolCallEvent):
339-
for tc in event.tool_calls:
340-
tool_calls_delta = [
336+
tool_calls_delta = [
337+
{
338+
"index": i,
339+
"id": getattr(tc, "tool_id", ""),
340+
"type": "function",
341+
"function": {
342+
"name": tc.tool_name,
343+
"arguments": json.dumps(tc.tool_kwargs),
344+
},
345+
}
346+
for i, tc in enumerate(event.tool_calls)
347+
]
348+
data = {
349+
"id": completion_id,
350+
"object": "chat.completion.chunk",
351+
"created": created,
352+
"model": model_id,
353+
"choices": [
341354
{
342355
"index": 0,
343-
"id": getattr(tc, "tool_id", ""),
344-
"type": "function",
345-
"function": {
346-
"name": tc.tool_name,
347-
"arguments": json.dumps(tc.tool_kwargs),
356+
"delta": {
357+
"role": "assistant",
358+
"tool_calls": tool_calls_delta,
348359
},
360+
"finish_reason": None,
349361
}
350-
]
351-
data = {
352-
"id": completion_id,
353-
"object": "chat.completion.chunk",
354-
"created": created,
355-
"model": model_id,
356-
"choices": [
357-
{
358-
"index": 0,
359-
"delta": {
360-
"role": "assistant",
361-
"tool_calls": tool_calls_delta,
362-
},
363-
"finish_reason": None,
364-
}
365-
],
366-
}
367-
yield f"data: {json.dumps(data)}\n\n"
362+
],
363+
}
364+
yield f"data: {json.dumps(data)}\n\n"
368365

369366
elif isinstance(event, InputEvent):
370367
if event.input:

agents/base/openai_responses_agent/main.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,7 @@ class ChatCompletionResponse(BaseModel):
8888
)
8989
model: str = Field(..., description="The model used for the chat completion.")
9090
choices: list[Choice] = Field(..., description="A list of chat completion choices.")
91-
context: list[dict] | None = Field(
92-
None,
93-
description="Full conversation context including tool calls and results.",
94-
)
91+
9592
usage: dict | None = Field(
9693
None, description="Usage statistics for the completion request."
9794
)

agents/community/langgraph_agentic_rag/main.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,7 @@ class ChatCompletionResponse(BaseModel):
8989
)
9090
model: str = Field(..., description="The model used for the chat completion.")
9191
choices: list[Choice] = Field(..., description="A list of chat completion choices.")
92-
context: list[dict] | None = Field(
93-
None,
94-
description="Full conversation context including tool calls and results.",
95-
)
92+
9693
usage: dict | None = Field(
9794
None, description="Usage statistics for the completion request."
9895
)

agents/community/langgraph_react_with_database_memory/main.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
import json
22
import logging
3-
import os
43
import time
54
import uuid
65
from contextlib import asynccontextmanager
76

87
from fastapi import FastAPI, HTTPException
98
from fastapi.responses import StreamingResponse
109
from langchain_core.messages import HumanMessage, AIMessage, ToolMessage, SystemMessage
11-
from pydantic import BaseModel, Field
1210
from langgraph.checkpoint.postgres import PostgresSaver
1311
from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver
12+
from pydantic import BaseModel, Field
13+
from os import getenv
1414

1515
from langgraph_react_with_database_memory_base.agent import get_graph_closure
1616
from langgraph_react_with_database_memory_base.utils import (
17-
getenv,
1817
get_database_uri,
1918
)
2019

@@ -99,10 +98,7 @@ class ChatCompletionResponse(BaseModel):
9998
)
10099
model: str = Field(..., description="The model used for the chat completion.")
101100
choices: list[Choice] = Field(..., description="A list of chat completion choices.")
102-
context: list[dict] | None = Field(
103-
None,
104-
description="Full conversation context including tool calls and results.",
105-
)
101+
106102
usage: dict | None = Field(
107103
None, description="Usage statistics for the completion request."
108104
)
@@ -471,5 +467,5 @@ async def health():
471467
if __name__ == "__main__":
472468
import uvicorn
473469

474-
port = int(os.getenv("PORT", 8000))
470+
port = int(getenv("PORT", 8000))
475471
uvicorn.run(app, host="0.0.0.0", port=port)

0 commit comments

Comments
 (0)