Skip to content

Commit

Permalink
新增Json数据类型
Browse files Browse the repository at this point in the history
  • Loading branch information
yinjiaqi authored and yinjiaqi committed Dec 12, 2024
1 parent 797c3cb commit dddc55a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/core/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ class FunctionCall(BaseModel, extra='allow'):
name: str = Field(default="", description="工具名")
arguments: dict = Field(default={}, description="参数列表")

class Json(BaseModel, extra='allow'):
json_data: dict = Field(default={}, description="json数据")

class Content(BaseModel):
name: str = Field(default="",
Expand All @@ -140,7 +142,7 @@ class Content(BaseModel):
description="耗时、性能、内存等trace及debug所需信息")
type: str = Field(default="text",
description="代表event 类型,包括 text、code、files、urls、oral_text、references、image、chart、audio该字段的取值决定了下面text字段的内容结构")
text: Union[Text, Code, Files, Urls, OralText, References, Image, Chart, Audio, Plan, FunctionCall] = Field(default=Text,
text: Union[Text, Code, Files, Urls, OralText, References, Image, Chart, Audio, Plan, Json, FunctionCall] = Field(default=Text,
description="代表当前 event 元素的内容,每一种 event 对应的 text 结构固定")

@field_validator('text', mode='before')
Expand Down

0 comments on commit dddc55a

Please sign in to comment.