30 lines
1.4 KiB
Python
30 lines
1.4 KiB
Python
from typing import Optional
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class AiCallOptions(BaseModel):
|
|
"""Options for centralized AI processing (no document extraction here)."""
|
|
|
|
operationType: str = Field(default="general", description="Type of operation")
|
|
priority: str = Field(default="balanced", description="speed|quality|cost|balanced")
|
|
compressPrompt: bool = Field(default=True, description="Whether to compress the prompt")
|
|
compressContext: bool = Field(default=True, description="Whether to compress optional context")
|
|
maxCost: Optional[float] = Field(default=None, description="Max cost budget")
|
|
maxProcessingTime: Optional[int] = Field(default=None, description="Max processing time in seconds")
|
|
|
|
|
|
class AiCallRequest(BaseModel):
|
|
"""Centralized AI call request payload for interface use."""
|
|
|
|
prompt: str = Field(description="The user prompt")
|
|
context: Optional[str] = Field(default=None, description="Optional external context (e.g., extracted docs)")
|
|
options: AiCallOptions = Field(default_factory=AiCallOptions)
|
|
|
|
|
|
class AiCallResponse(BaseModel):
|
|
"""Standardized AI call response."""
|
|
|
|
content: str = Field(description="AI response content")
|
|
modelName: str = Field(description="Selected model name")
|
|
usedTokens: Optional[int] = Field(default=None, description="Estimated used tokens")
|
|
costEstimate: Optional[float] = Field(default=None, description="Estimated cost of the call")
|