mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-04-30 04:30:13 +00:00
chore: map zai to openai compatible
This commit is contained in:
parent
e7c05b5569
commit
b272dbbfda
2 changed files with 15 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from fastapi import APIRouter, HTTPException
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
from app.component.model_validation import create_agent
|
||||
from app.model.chat import PLATFORM_MAPPING
|
||||
from camel.types import ModelType
|
||||
from app.component.error_format import normalize_error_to_openai_format
|
||||
from utils import traceroot_wrapper as traceroot
|
||||
|
|
@ -19,6 +20,11 @@ class ValidateModelRequest(BaseModel):
|
|||
model_config_dict: dict | None = Field(None, description="Model config dict")
|
||||
extra_params: dict | None = Field(None, description="Extra model parameters")
|
||||
|
||||
@field_validator("model_platform")
|
||||
@classmethod
|
||||
def map_model_platform(cls, v: str) -> str:
|
||||
return PLATFORM_MAPPING.get(v, v)
|
||||
|
||||
|
||||
class ValidateModelResponse(BaseModel):
|
||||
is_valid: bool = Field(..., description="Is valid")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue