Align expected types to actual returned types by AI APIs, operator

This commit is contained in:
Debanjum
2025-05-26 00:37:26 -07:00
parent c1c1fc6265
commit c9e6b8e88d
4 changed files with 7 additions and 7 deletions

View File

@@ -164,7 +164,7 @@ async def converse_anthropic(
generated_asset_results: Dict[str, Dict] = {},
deepthought: Optional[bool] = False,
tracer: dict = {},
) -> AsyncGenerator[ResponseWithThought, None]:
) -> AsyncGenerator[str | ResponseWithThought, None]:
"""
Converse with user using Anthropic's Claude
"""

View File

@@ -190,7 +190,7 @@ async def converse_openai(
program_execution_context: List[str] = None,
deepthought: Optional[bool] = False,
tracer: dict = {},
) -> AsyncGenerator[ResponseWithThought, None]:
) -> AsyncGenerator[str | ResponseWithThought, None]:
"""
Converse with user using OpenAI's ChatGPT
"""

View File

@@ -13,7 +13,7 @@ from io import BytesIO
from typing import Any, List
import numpy as np
from openai import AzureOpenAI, OpenAI
from openai import AsyncAzureOpenAI, AsyncOpenAI
from openai.types.chat import ChatCompletion
from PIL import Image
@@ -72,7 +72,7 @@ class GroundingAgentUitars:
def __init__(
self,
model_name: str,
client: OpenAI | AzureOpenAI,
client: AsyncOpenAI | AsyncAzureOpenAI,
max_iterations=50,
environment_type: Literal["computer", "web"] = "computer",
runtime_conf: dict = {

View File

@@ -72,7 +72,7 @@ async def update_chat_model(
if chat_model is None:
return Response(status_code=404, content=json.dumps({"status": "error", "message": "Chat model not found"}))
if not subscribed and chat_model.price_tier != PriceTier.FREE:
raise Response(
return Response(
status_code=403,
content=json.dumps({"status": "error", "message": "Subscribe to switch to this chat model"}),
)
@@ -108,7 +108,7 @@ async def update_voice_model(
if voice_model is None:
return Response(status_code=404, content=json.dumps({"status": "error", "message": "Voice model not found"}))
if not subscribed and voice_model.price_tier != PriceTier.FREE:
raise Response(
return Response(
status_code=403,
content=json.dumps({"status": "error", "message": "Subscribe to switch to this voice model"}),
)
@@ -143,7 +143,7 @@ async def update_paint_model(
if image_model is None:
return Response(status_code=404, content=json.dumps({"status": "error", "message": "Image model not found"}))
if not subscribed and image_model.price_tier != PriceTier.FREE:
raise Response(
return Response(
status_code=403,
content=json.dumps({"status": "error", "message": "Subscribe to switch to this image model"}),
)