Voice et bot modif
This commit is contained in:
parent
189d56026b
commit
7333a22bcd
10774 changed files with 634644 additions and 933308 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -150,7 +150,7 @@ async def run_agent(
|
|||
config["apiKey"] = substituted_api_key
|
||||
# Main agent loop
|
||||
async with Agent(
|
||||
provider=config.get("provider"), # type: ignore[arg-type]
|
||||
provider=config.get("provider"), # type: ignore
|
||||
model=config.get("model"),
|
||||
base_url=config.get("endpointUrl"), # type: ignore[arg-type]
|
||||
api_key=config.get("apiKey"),
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ problem and think insightfully.
|
|||
|
||||
MAX_NUM_TURNS = 10
|
||||
|
||||
TASK_COMPLETE_TOOL: ChatCompletionInputTool = ChatCompletionInputTool.parse_obj( # type: ignore[assignment]
|
||||
TASK_COMPLETE_TOOL: ChatCompletionInputTool = ChatCompletionInputTool.parse_obj( # type: ignore
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
|
|
@ -61,7 +61,7 @@ TASK_COMPLETE_TOOL: ChatCompletionInputTool = ChatCompletionInputTool.parse_obj(
|
|||
}
|
||||
)
|
||||
|
||||
ASK_QUESTION_TOOL: ChatCompletionInputTool = ChatCompletionInputTool.parse_obj( # type: ignore[assignment]
|
||||
ASK_QUESTION_TOOL: ChatCompletionInputTool = ChatCompletionInputTool.parse_obj( # type: ignore
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
|
|
|
|||
|
|
@ -39,33 +39,35 @@ def format_result(result: "mcp_types.CallToolResult") -> str:
|
|||
formatted_parts: list[str] = []
|
||||
|
||||
for item in content:
|
||||
if item.type == "text":
|
||||
formatted_parts.append(item.text)
|
||||
match item.type:
|
||||
case "text":
|
||||
formatted_parts.append(item.text)
|
||||
|
||||
elif item.type == "image":
|
||||
formatted_parts.append(
|
||||
f"[Binary Content: Image {item.mimeType}, {_get_base64_size(item.data)} bytes]\n"
|
||||
f"The task is complete and the content accessible to the User"
|
||||
)
|
||||
|
||||
elif item.type == "audio":
|
||||
formatted_parts.append(
|
||||
f"[Binary Content: Audio {item.mimeType}, {_get_base64_size(item.data)} bytes]\n"
|
||||
f"The task is complete and the content accessible to the User"
|
||||
)
|
||||
|
||||
elif item.type == "resource":
|
||||
resource = item.resource
|
||||
|
||||
if hasattr(resource, "text") and isinstance(resource.text, str):
|
||||
formatted_parts.append(resource.text)
|
||||
|
||||
elif hasattr(resource, "blob") and isinstance(resource.blob, str):
|
||||
case "image":
|
||||
formatted_parts.append(
|
||||
f"[Binary Content ({resource.uri}): {resource.mimeType}, {_get_base64_size(resource.blob)} bytes]\n"
|
||||
f"[Binary Content: Image {item.mimeType}, {_get_base64_size(item.data)} bytes]\n"
|
||||
f"The task is complete and the content accessible to the User"
|
||||
)
|
||||
|
||||
case "audio":
|
||||
formatted_parts.append(
|
||||
f"[Binary Content: Audio {item.mimeType}, {_get_base64_size(item.data)} bytes]\n"
|
||||
f"The task is complete and the content accessible to the User"
|
||||
)
|
||||
|
||||
case "resource":
|
||||
resource = item.resource
|
||||
|
||||
if hasattr(resource, "text") and isinstance(resource.text, str):
|
||||
formatted_parts.append(resource.text)
|
||||
|
||||
elif hasattr(resource, "blob") and isinstance(resource.blob, str):
|
||||
formatted_parts.append(
|
||||
f"[Binary Content ({resource.uri}): {resource.mimeType},"
|
||||
f" {_get_base64_size(resource.blob)} bytes]\n"
|
||||
f"The task is complete and the content accessible to the User"
|
||||
)
|
||||
|
||||
return "\n".join(formatted_parts)
|
||||
|
||||
|
||||
|
|
@ -102,7 +104,7 @@ def _load_agent_config(agent_path: Optional[str]) -> tuple[AgentConfig, Optional
|
|||
return config, prompt
|
||||
|
||||
if agent_path is None:
|
||||
return DEFAULT_AGENT, None # type: ignore[return-value]
|
||||
return DEFAULT_AGENT, None # type: ignore
|
||||
|
||||
path = Path(agent_path).expanduser()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue