From 3bc1a807dfd82c6a3cdc4e492e6ba2c637dd7cae Mon Sep 17 00:00:00 2001 From: mrh997 Date: Thu, 23 Oct 2025 17:25:54 +0800 Subject: [PATCH] fix: use jsonschema_description tag (#123) --- .../subagents/ask_for_clarification.go | 2 +- adk/intro/chatmodel/subagents/booksearch.go | 6 +- adk/intro/session/session_values.go | 4 +- .../agents/coder.go | 4 +- .../agents/researcher.go | 4 +- .../tools/ask_for_clarification.go | 2 +- .../plan-execute-replan/tools/travel_tools.go | 24 ++--- .../plan_execute/tools/theme_park.go | 100 +++++++++--------- .../eino-docs/agent_llm_with_tools.md | 10 +- .../pkg/tool/einotool/einotool.go | 14 +-- .../pkg/tool/gitclone/gitclone.go | 4 +- .../eino_assistant/pkg/tool/open/open.go | 4 +- .../eino_assistant/pkg/tool/task/task.go | 30 +++--- quickstart/todoagent/main.go | 10 +- 14 files changed, 109 insertions(+), 109 deletions(-) diff --git a/adk/intro/chatmodel/subagents/ask_for_clarification.go b/adk/intro/chatmodel/subagents/ask_for_clarification.go index 00e1442..d9a4ccd 100644 --- a/adk/intro/chatmodel/subagents/ask_for_clarification.go +++ b/adk/intro/chatmodel/subagents/ask_for_clarification.go @@ -36,7 +36,7 @@ func WithNewInput(input string) tool.Option { } type AskForClarificationInput struct { - Question string `json:"question" jsonschema:"description=The specific question you want to ask the user to get the missing information"` + Question string `json:"question" jsonschema_description:"The specific question you want to ask the user to get the missing information"` } func NewAskForClarificationTool() tool.InvokableTool { diff --git a/adk/intro/chatmodel/subagents/booksearch.go b/adk/intro/chatmodel/subagents/booksearch.go index 6c33ebc..d267f51 100644 --- a/adk/intro/chatmodel/subagents/booksearch.go +++ b/adk/intro/chatmodel/subagents/booksearch.go @@ -25,9 +25,9 @@ import ( ) type BookSearchInput struct { - Genre string `json:"genre" jsonschema:"description=Preferred book genre,enum=fiction,enum=sci-fi,enum=mystery,enum=biography,enum=business"` - MaxPages int `json:"max_pages" jsonschema:"description=Maximum page length (0 for no limit)"` - MinRating int `json:"min_rating" jsonschema:"description=Minimum user rating (0-5 scale)"` + Genre string `json:"genre" jsonschema_description:"Preferred book genre,enum=fiction,enum=sci-fi,enum=mystery,enum=biography,enum=business"` + MaxPages int `json:"max_pages" jsonschema_description:"Maximum page length (0 for no limit)"` + MinRating int `json:"min_rating" jsonschema_description:"Minimum user rating (0-5 scale)"` } type BookSearchOutput struct { diff --git a/adk/intro/session/session_values.go b/adk/intro/session/session_values.go index 52fc541..c9eed3a 100644 --- a/adk/intro/session/session_values.go +++ b/adk/intro/session/session_values.go @@ -77,7 +77,7 @@ func main() { } type ToolAInput struct { - Name string `json:"input" jsonschema:"description=user's name'"` + Name string `json:"input" jsonschema_description:"user's name'"` } func toolAFn(ctx context.Context, in *ToolAInput) (string, error) { @@ -87,7 +87,7 @@ func toolAFn(ctx context.Context, in *ToolAInput) (string, error) { } type ToolBInput struct { - Age int `json:"input" jsonschema:"description=user's age'"` + Age int `json:"input" jsonschema_description:"user's age'"` } func toolBFn(ctx context.Context, in *ToolBInput) (string, error) { diff --git a/adk/multiagent/integration-project-manager/agents/coder.go b/adk/multiagent/integration-project-manager/agents/coder.go index 7e51b3a..50855b4 100644 --- a/adk/multiagent/integration-project-manager/agents/coder.go +++ b/adk/multiagent/integration-project-manager/agents/coder.go @@ -29,8 +29,8 @@ import ( func NewCodeAgent(ctx context.Context, tcm model.ToolCallingChatModel) (adk.Agent, error) { type RAGInput struct { - Query string `json:"query" jsonschema:"description=query for search"` - Context *string `json:"context" jsonschema:"description=user input context"` + Query string `json:"query" jsonschema_description:"query for search"` + Context *string `json:"context" jsonschema_description:"user input context"` } type RAGOutput struct { Documents []string `json:"documents"` diff --git a/adk/multiagent/integration-project-manager/agents/researcher.go b/adk/multiagent/integration-project-manager/agents/researcher.go index f0c27b1..87c4366 100644 --- a/adk/multiagent/integration-project-manager/agents/researcher.go +++ b/adk/multiagent/integration-project-manager/agents/researcher.go @@ -30,7 +30,7 @@ import ( func NewResearchAgent(ctx context.Context, tcm model.ToolCallingChatModel) (adk.Agent, error) { type webSearchInput struct { - CurrentContext string `json:"current_context" jsonschema:"description=current context for web search"` + CurrentContext string `json:"current_context" jsonschema_description:"current context for web search"` } type webSearchOutput struct { Result []string @@ -88,7 +88,7 @@ func WithNewInput(input string) tool.Option { } type AskForClarificationInput struct { - Question string `json:"question" jsonschema:"description=The specific question you want to ask the user to get the missing information"` + Question string `json:"question" jsonschema_description:"The specific question you want to ask the user to get the missing information"` } func newAskForClarificationTool() tool.InvokableTool { diff --git a/adk/multiagent/plan-execute-replan/tools/ask_for_clarification.go b/adk/multiagent/plan-execute-replan/tools/ask_for_clarification.go index 7cb6051..c01c2f1 100644 --- a/adk/multiagent/plan-execute-replan/tools/ask_for_clarification.go +++ b/adk/multiagent/plan-execute-replan/tools/ask_for_clarification.go @@ -28,7 +28,7 @@ import ( ) type AskForClarificationInput struct { - Question string `json:"question" jsonschema:"description=The specific question you want to ask the user to get the missing information"` + Question string `json:"question" jsonschema_description:"The specific question you want to ask the user to get the missing information"` } func NewAskForClarificationTool() tool.InvokableTool { diff --git a/adk/multiagent/plan-execute-replan/tools/travel_tools.go b/adk/multiagent/plan-execute-replan/tools/travel_tools.go index 38a7ea4..1999799 100644 --- a/adk/multiagent/plan-execute-replan/tools/travel_tools.go +++ b/adk/multiagent/plan-execute-replan/tools/travel_tools.go @@ -27,8 +27,8 @@ import ( // WeatherRequest represents a weather query request type WeatherRequest struct { - City string `json:"city" jsonschema:"description=City name to get weather for"` - Date string `json:"date" jsonschema:"description=Date in YYYY-MM-DD format (optional)"` + City string `json:"city" jsonschema_description:"City name to get weather for"` + Date string `json:"date" jsonschema_description:"Date in YYYY-MM-DD format (optional)"` } // WeatherResponse represents weather information @@ -42,10 +42,10 @@ type WeatherResponse struct { // FlightRequest represents a flight search request type FlightRequest struct { - From string `json:"from" jsonschema:"description=Departure city"` - To string `json:"to" jsonschema:"description=Destination city"` - Date string `json:"date" jsonschema:"description=Departure date in YYYY-MM-DD format"` - Passengers int `json:"passengers" jsonschema:"description=Number of passengers"` + From string `json:"from" jsonschema_description:"Departure city"` + To string `json:"to" jsonschema_description:"Destination city"` + Date string `json:"date" jsonschema_description:"Departure date in YYYY-MM-DD format"` + Passengers int `json:"passengers" jsonschema_description:"Number of passengers"` } // FlightResponse represents flight search results @@ -65,10 +65,10 @@ type Flight struct { // HotelRequest represents a hotel search request type HotelRequest struct { - City string `json:"city" jsonschema:"description=City to search hotels in"` - CheckIn string `json:"check_in" jsonschema:"description=Check-in date in YYYY-MM-DD format"` - CheckOut string `json:"check_out" jsonschema:"description=Check-out date in YYYY-MM-DD format"` - Guests int `json:"guests" jsonschema:"description=Number of guests"` + City string `json:"city" jsonschema_description:"City to search hotels in"` + CheckIn string `json:"check_in" jsonschema_description:"Check-in date in YYYY-MM-DD format"` + CheckOut string `json:"check_out" jsonschema_description:"Check-out date in YYYY-MM-DD format"` + Guests int `json:"guests" jsonschema_description:"Number of guests"` } // HotelResponse represents hotel search results @@ -87,8 +87,8 @@ type Hotel struct { // AttractionRequest represents a tourist attraction search request type AttractionRequest struct { - City string `json:"city" jsonschema:"description=City to search attractions in"` - Category string `json:"category" jsonschema:"description=Category of attractions (museum, park, landmark, historic site, etc.)"` + City string `json:"city" jsonschema_description:"City to search attractions in"` + Category string `json:"category" jsonschema_description:"Category of attractions (museum, park, landmark, historic site, etc.)"` } // AttractionResponse represents attraction search results diff --git a/flow/agent/multiagent/plan_execute/tools/theme_park.go b/flow/agent/multiagent/plan_execute/tools/theme_park.go index 77bcaf4..af97934 100644 --- a/flow/agent/multiagent/plan_execute/tools/theme_park.go +++ b/flow/agent/multiagent/plan_execute/tools/theme_park.go @@ -37,70 +37,70 @@ type Activity struct { Name string `json:"name"` Desc string `json:"desc"` Type ActivityType `json:"type"` - Location string `json:"location" jsonschema:"description=项目所属的区域"` - MinHeight int `json:"min_height,omitempty" jsonschema:"description=参加游乐设施需要的最小身高,单位是厘米。如果为空,则没有身高要求"` - Duration int `json:"duration,omitempty" jsonschema:"description=一个项目参加一次需要的时间,注意不包括排队的时间。如果为空,则缺少具体的时间信息,可以默认为 10 分钟"` - TimeTable []string `json:"time_table,omitempty" jsonschema:"description=一个演出的时间表。如果为空,则使用 OpenTime 和 CloseTime 来表示这个项目的运营时间范围"` - OpenTime string `json:"open_time,omitempty" jsonschema:"description=一个项目开始运营的时间"` - CloseTime string `json:"close_time,omitempty" jsonschema:"description=一个项目结束运营的时间"` - RequireBooking bool `json:"require_booking,omitempty" jsonschema:"description=一个餐厅是否需要提前预约"` - HasPriorityAccess bool `json:"has_priority_access,omitempty" jsonschema:"description=一个项目是否有高速票服务"` - PriorityAccessCost int `json:"priority_access_cost,omitempty" jsonschema:"description=一个项目如果有高速票服务,则一个人的高速票需要花多少钱"` - QueueTime float64 `json:"queue_time,omitempty" jsonschema:"description=一个项目常规需要的排队时间,单位是分钟。如果为空,则这个项目一般不需要排队"` + Location string `json:"location" jsonschema_description:"项目所属的区域"` + MinHeight int `json:"min_height,omitempty" jsonschema_description:"参加游乐设施需要的最小身高,单位是厘米。如果为空,则没有身高要求"` + Duration int `json:"duration,omitempty" jsonschema_description:"一个项目参加一次需要的时间,注意不包括排队的时间。如果为空,则缺少具体的时间信息,可以默认为 10 分钟"` + TimeTable []string `json:"time_table,omitempty" jsonschema_description:"一个演出的时间表。如果为空,则使用 OpenTime 和 CloseTime 来表示这个项目的运营时间范围"` + OpenTime string `json:"open_time,omitempty" jsonschema_description:"一个项目开始运营的时间"` + CloseTime string `json:"close_time,omitempty" jsonschema_description:"一个项目结束运营的时间"` + RequireBooking bool `json:"require_booking,omitempty" jsonschema_description:"一个餐厅是否需要提前预约"` + HasPriorityAccess bool `json:"has_priority_access,omitempty" jsonschema_description:"一个项目是否有高速票服务"` + PriorityAccessCost int `json:"priority_access_cost,omitempty" jsonschema_description:"一个项目如果有高速票服务,则一个人的高速票需要花多少钱"` + QueueTime float64 `json:"queue_time,omitempty" jsonschema_description:"一个项目常规需要的排队时间,单位是分钟。如果为空,则这个项目一般不需要排队"` } // LocationAdjacency 主题乐园的一个区域到相邻区域的步行时间. type LocationAdjacency struct { - FromLocationName string `json:"from_location_name" jsonschema:"description=从哪个区域开始计算距离"` - DestinationLocationWalkingTimes []DestinationWalkingTime `json:"destination_location_walking_times,omitempty" jsonschema:"description=相邻区域列表,包含走路的分钟数"` + FromLocationName string `json:"from_location_name" jsonschema_description:"从哪个区域开始计算距离"` + DestinationLocationWalkingTimes []DestinationWalkingTime `json:"destination_location_walking_times,omitempty" jsonschema_description:"相邻区域列表,包含走路的分钟数"` } type DestinationWalkingTime struct { - DestinationName string `json:"destination_name" jsonschema:"description=目标区域名称"` - WalkTime float64 `json:"walk_time" jsonschema:"description=步行到目标区域所需要的分钟数"` + DestinationName string `json:"destination_name" jsonschema_description:"目标区域名称"` + WalkTime float64 `json:"walk_time" jsonschema_description:"步行到目标区域所需要的分钟数"` } // AttractionQueueTime 主题乐园的一个游乐项目的排队时间. type AttractionQueueTime struct { - Name string `json:"name" jsonschema:"description=游乐项目的名称"` - QueueTime float64 `json:"queue_time" jsonschema:"description=游乐项目的排队时间"` + Name string `json:"name" jsonschema_description:"游乐项目的名称"` + QueueTime float64 `json:"queue_time" jsonschema_description:"游乐项目的排队时间"` } type ListPerformanceRequest struct { - Name string `json:"name,omitempty" jsonschema:"description=演出的名称,如果不需要查询具体的某个演出,此处传空"` - Location string `json:"location,omitempty" jsonschema:"description=演出所在的区域,如果不需要查询具体某个区域的演出,此处传空"` + Name string `json:"name,omitempty" jsonschema_description:"演出的名称,如果不需要查询具体的某个演出,此处传空"` + Location string `json:"location,omitempty" jsonschema_description:"演出所在的区域,如果不需要查询具体某个区域的演出,此处传空"` } type ListPerformanceResponse struct { - Performances []Activity `json:"performances" jsonschema:"description=符合查询条件的所有演出的信息"` + Performances []Activity `json:"performances" jsonschema_description:"符合查询条件的所有演出的信息"` } type ListAttractionRequest struct { - Name string `json:"name,omitempty" jsonschema:"description=游乐项目的名称,如果不需要查询具体的某个游乐项目,此处传空"` - Location string `json:"location,omitempty" jsonschema:"description=游乐项目所在的区域,如果不需要查询具体某个区域的游乐项目,此处传空"` + Name string `json:"name,omitempty" jsonschema_description:"游乐项目的名称,如果不需要查询具体的某个游乐项目,此处传空"` + Location string `json:"location,omitempty" jsonschema_description:"游乐项目所在的区域,如果不需要查询具体某个区域的游乐项目,此处传空"` } type ListAttractionResponse struct { - Attractions []Activity `json:"attractions" jsonschema:"description=符合查询条件的所有游乐项目的信息"` + Attractions []Activity `json:"attractions" jsonschema_description:"符合查询条件的所有游乐项目的信息"` } type ListRestaurantRequest struct { - Name string `json:"name,omitempty" jsonschema:"description=餐厅的名称,如果不需要查询具体的某个餐厅,此处传空"` - Location string `json:"location,omitempty" jsonschema:"description=餐厅所在的区域,如果不需要查询具体某个区域的餐厅,此处传空"` + Name string `json:"name,omitempty" jsonschema_description:"餐厅的名称,如果不需要查询具体的某个餐厅,此处传空"` + Location string `json:"location,omitempty" jsonschema_description:"餐厅所在的区域,如果不需要查询具体某个区域的餐厅,此处传空"` } type ListRestaurantResponse struct { - Restaurants []Activity `json:"restaurants" jsonschema:"description=符合查询条件的所有餐厅的信息"` + Restaurants []Activity `json:"restaurants" jsonschema_description:"符合查询条件的所有餐厅的信息"` } type ListAttractionQueueTimeRequest struct { - Name string `json:"name,omitempty" jsonschema:"description=游乐项目的名称,如果不需要查询具体的某个游乐项目的排队时间,此处传空"` - Location string `json:"location,omitempty" jsonschema:"description=游乐项目所在的区域,如果不需要查询具体某个区域的游乐项目的排队时间,此处传空"` + Name string `json:"name,omitempty" jsonschema_description:"游乐项目的名称,如果不需要查询具体的某个游乐项目的排队时间,此处传空"` + Location string `json:"location,omitempty" jsonschema_description:"游乐项目所在的区域,如果不需要查询具体某个区域的游乐项目的排队时间,此处传空"` } type ListAttractionQueueTimeResponse struct { - QueueTime []AttractionQueueTime `json:"queue_time" jsonschema:"description=符合查询条件的所有游乐项目的排队时间"` + QueueTime []AttractionQueueTime `json:"queue_time" jsonschema_description:"符合查询条件的所有游乐项目的排队时间"` } type ListAdjacentLocationRequest struct{} type ListAdjacentLocationResponse struct { - AdjacencyList []LocationAdjacency `json:"adjacency_list" jsonschema:"description=所有区域的邻接区域"` + AdjacencyList []LocationAdjacency `json:"adjacency_list" jsonschema_description:"所有区域的邻接区域"` } type GetParkHourRequest struct{} @@ -111,7 +111,7 @@ type GetParkHourResponse struct { type GetParkTicketPriceRequest struct{} type GetParkTicketPriceResponse struct { - Price string `json:"price" jsonschema:"description=乐园门票价格信息"` + Price string `json:"price" jsonschema_description:"乐园门票价格信息"` } type ListLocationsRequest struct{} @@ -136,7 +136,7 @@ func ListLocations(_ context.Context, _ *ListLocationsRequest) (out *ListLocatio type QueryEntranceRequest struct{} type QueryEntranceResponse struct { - EntranceLocation string `json:"entrance_location" jsonschema:"description=园区入口区域名称"` + EntranceLocation string `json:"entrance_location" jsonschema_description:"园区入口区域名称"` } func QueryEntrance(_ context.Context, _ *QueryEntranceRequest) (out *QueryEntranceResponse, err error) { @@ -321,10 +321,10 @@ func GetRestaurantInfo(_ context.Context, in *ListRestaurantRequest) (out *ListR type OnePerformanceStartTime struct { PerformanceName string `json:"performance_name"` - StartTime string `json:"start_time" jsonschema:"description=选中的演出开始时间,格式如15:30"` + StartTime string `json:"start_time" jsonschema_description:"选中的演出开始时间,格式如15:30"` } type ValidatePerformanceTimeTableRequest struct { - PerformancesStartTime []OnePerformanceStartTime `json:"performances_start_time" jsonschema:"description=用户选择的演出名称和开始时间"` + PerformancesStartTime []OnePerformanceStartTime `json:"performances_start_time" jsonschema_description:"用户选择的演出名称和开始时间"` } type PerformanceStartTimeValidateResult struct { PerformanceName string `json:"performance_name"` @@ -333,7 +333,7 @@ type PerformanceStartTimeValidateResult struct { ErrMessage string `json:"err_message"` } type ValidatePerformanceTimeTableResponse struct { - PerformancesValidateResult []PerformanceStartTimeValidateResult `json:"performances_validate_result" jsonschema:"description=验证结果,只包含有问题的表演"` + PerformancesValidateResult []PerformanceStartTimeValidateResult `json:"performances_validate_result" jsonschema_description:"验证结果,只包含有问题的表演"` } func ValidatePerformanceTimeTable(_ context.Context, in *ValidatePerformanceTimeTableRequest) (out *ValidatePerformanceTimeTableResponse, err error) { @@ -391,16 +391,16 @@ func contains(slice []string, item string) bool { } type ArrangePerformancesRequest struct { - ChosenPerformances []string `json:"chosen_performances" jsonschema:"description=用户选择的演出名称列表"` + ChosenPerformances []string `json:"chosen_performances" jsonschema_description:"用户选择的演出名称列表"` } type ArrangePerformancesResponse struct { - ArrangedPerformances []PerformanceTime `json:"arranged_performances" jsonschema:"description=根据用户选择的演出,以及实际的时间表和演出时长,计算出的看演出的时间规划。包含了每场演出的排队、占座时间。"` - UnsatisfiedPerformances []string `json:"unsatisfied_performances" jsonschema:"description=由于跟其他演出的时间冲突,无法完成时间安排的演出名称"` + ArrangedPerformances []PerformanceTime `json:"arranged_performances" jsonschema_description:"根据用户选择的演出,以及实际的时间表和演出时长,计算出的看演出的时间规划。包含了每场演出的排队、占座时间。"` + UnsatisfiedPerformances []string `json:"unsatisfied_performances" jsonschema_description:"由于跟其他演出的时间冲突,无法完成时间安排的演出名称"` } type PerformanceTime struct { - PerformanceName string `json:"performance_name" jsonschema:"description=演出名称"` - StartTime string `json:"start_time" jsonschema:"description=演出开始时间"` - EndTime string `json:"end_time" jsonschema:"description=演出结束时间"` + PerformanceName string `json:"performance_name" jsonschema_description:"演出名称"` + StartTime string `json:"start_time" jsonschema_description:"演出开始时间"` + EndTime string `json:"end_time" jsonschema_description:"演出结束时间"` } func getPerformances() []Activity { @@ -510,26 +510,26 @@ func ArrangePerformances(_ context.Context, in *ArrangePerformancesRequest) (out } type PlanItem struct { - ActivityType ActivityType `json:"activity_type" jsonschema:"description=活动类型,enum:attraction,enum:performance,enum:restaurant,enum:other"` - StartTime string `json:"start_time" jsonschema:"description=活动开始时间,格式为15:04"` - PerformanceStartTime *string `json:"performance_start_time" jsonschema:"description=如果为 performance 类型,是演出开始时间,格式为15:04. 否则忽略这个参数或传 NULL"` - Duration *int `json:"duration" jsonschema:"description=如果为 performance 类型,是演出时长,如果为 attraction 类型,是实际玩的时长,单位为分钟,否则忽略这个参数或传 Null"` - QueueTime *int `json:"queue_time" jsonschema:"description=排队时间,单位为分钟,attraction 类型必填,否则忽略这个参数或传 NULL。如果用了高速票,QueueTime使用0"` - Location string `json:"location" jsonschema:"description=计划所在的区域,如果是 move 类型的计划,这里是目标区域。可以填写的区域列表为通过 list_locations 获取的清单"` - ActivityName string `json:"activity_name,omitempty" jsonschema:"description=move 之外的其他类型的计划,这里是项目的准确名称,如 attraction,performance,restaurant 的准确名称"` + ActivityType ActivityType `json:"activity_type" jsonschema_description:"活动类型,enum:attraction,enum:performance,enum:restaurant,enum:other"` + StartTime string `json:"start_time" jsonschema_description:"活动开始时间,格式为15:04"` + PerformanceStartTime *string `json:"performance_start_time" jsonschema_description:"如果为 performance 类型,是演出开始时间,格式为15:04. 否则忽略这个参数或传 NULL"` + Duration *int `json:"duration" jsonschema_description:"如果为 performance 类型,是演出时长,如果为 attraction 类型,是实际玩的时长,单位为分钟,否则忽略这个参数或传 Null"` + QueueTime *int `json:"queue_time" jsonschema_description:"排队时间,单位为分钟,attraction 类型必填,否则忽略这个参数或传 NULL。如果用了高速票,QueueTime使用0"` + Location string `json:"location" jsonschema_description:"计划所在的区域,如果是 move 类型的计划,这里是目标区域。可以填写的区域列表为通过 list_locations 获取的清单"` + ActivityName string `json:"activity_name,omitempty" jsonschema_description:"move 之外的其他类型的计划,这里是项目的准确名称,如 attraction,performance,restaurant 的准确名称"` } type PlanItemValidationResult struct { - PlanItem PlanItem `json:"plan_item" jsonschema:"description=完整一日计划其中的一个计划项"` + PlanItem PlanItem `json:"plan_item" jsonschema_description:"完整一日计划其中的一个计划项"` IsValid bool `json:"is_valid"` ErrMsg string `json:"err_msg"` } type ValidatePlanItemsRequest struct { - PlanItems []PlanItem `json:"plan_items" jsonschema:"description=一个完整的一日日程计划,包含了所有的活动和移动计划,按时间先后顺序排列"` + PlanItems []PlanItem `json:"plan_items" jsonschema_description:"一个完整的一日日程计划,包含了所有的活动和移动计划,按时间先后顺序排列"` } type ValidatePlanItemsResponse struct { - ValidationResults []PlanItemValidationResult `json:"validation_results" jsonschema:"description=每个计划项的验证结果,包含是否有效和错误信息,只包含有问题的计划项"` + ValidationResults []PlanItemValidationResult `json:"validation_results" jsonschema_description:"每个计划项的验证结果,包含是否有效和错误信息,只包含有问题的计划项"` } func ValidatePlanItems(_ context.Context, in *ValidatePlanItemsRequest) (out *ValidatePlanItemsResponse, err error) { diff --git a/quickstart/eino_assistant/cmd/knowledgeindexing/eino-docs/agent_llm_with_tools.md b/quickstart/eino_assistant/cmd/knowledgeindexing/eino-docs/agent_llm_with_tools.md index 36f7f13..5324f2c 100644 --- a/quickstart/eino_assistant/cmd/knowledgeindexing/eino-docs/agent_llm_with_tools.md +++ b/quickstart/eino_assistant/cmd/knowledgeindexing/eino-docs/agent_llm_with_tools.md @@ -63,11 +63,11 @@ func getAddTaskTool() tool.InvokableTool { ```go type TaskUpdateParams struct { - ID string `json:"id" jsonschema:"description=id of the task"` - Content *string `json:"content,omitempty" jsonschema:"description=content of the task"` - StartedAt *int64 `json:"started_at,omitempty" jsonschema:"description=start time in unix timestamp"` - Deadline *int64 `json:"deadline,omitempty" jsonschema:"description=deadline of the task in unix timestamp"` - Done *bool `json:"done,omitempty" jsonschema:"description=done status"` + ID string `json:"id" jsonschema_description:"id of the task"` + Content *string `json:"content,omitempty" jsonschema_description:"content of the task"` + StartedAt *int64 `json:"started_at,omitempty" jsonschema_description:"start time in unix timestamp"` + Deadline *int64 `json:"deadline,omitempty" jsonschema_description:"deadline of the task in unix timestamp"` + Done *bool `json:"done,omitempty" jsonschema_description:"done status"` } // 使用 InferTool 创建工具 diff --git a/quickstart/eino_assistant/pkg/tool/einotool/einotool.go b/quickstart/eino_assistant/pkg/tool/einotool/einotool.go index b283d4d..bd8b421 100644 --- a/quickstart/eino_assistant/pkg/tool/einotool/einotool.go +++ b/quickstart/eino_assistant/pkg/tool/einotool/einotool.go @@ -178,14 +178,14 @@ const ( ) type EinoToolRequest struct { - Action EinoToolAction `json:"action" jsonschema:"description='The action of the request',enum=get_example_project,enum=get_github_repo,enum=get_doc_url,enum=init_template"` - ExampleType string `json:"example_type,omitempty" jsonschema:"description='The type of the example project, only for action: get_example_project',enum=agent,enum=components,enum=graph,enum=quickstart"` - RepoType string `json:"repo_type,omitempty" jsonschema:"description='The type of the repo, only for action: get_github_repo',enum=eino,enum=eino-ext,enum=eino-examples"` - DocType string `json:"doc_type,omitempty" jsonschema:"description='The type of the doc, only for action: get_doc_url',enum=eino_index,enum=quickstart,enum=graph,enum=agent,enum=components,enum=integrate"` - TemplateType string `json:"template_type,omitempty" jsonschema:"description='The template of the project, only for action: init_template',enum=react_agent,enum=simple_llm,enum=http_agent"` + Action EinoToolAction `json:"action" jsonschema_description:"'The action of the request',enum=get_example_project,enum=get_github_repo,enum=get_doc_url,enum=init_template"` + ExampleType string `json:"example_type,omitempty" jsonschema_description:"'The type of the example project, only for action: get_example_project',enum=agent,enum=components,enum=graph,enum=quickstart"` + RepoType string `json:"repo_type,omitempty" jsonschema_description:"'The type of the repo, only for action: get_github_repo',enum=eino,enum=eino-ext,enum=eino-examples"` + DocType string `json:"doc_type,omitempty" jsonschema_description:"'The type of the doc, only for action: get_doc_url',enum=eino_index,enum=quickstart,enum=graph,enum=agent,enum=components,enum=integrate"` + TemplateType string `json:"template_type,omitempty" jsonschema_description:"'The template of the project, only for action: init_template',enum=react_agent,enum=simple_llm,enum=http_agent"` } type EinoToolResponse struct { - Message string `json:"message" jsonschema:"description=The message of the response"` - Error string `json:"error" jsonschema:"description=The error of the response"` + Message string `json:"message" jsonschema_description:"The message of the response"` + Error string `json:"error" jsonschema_description:"The error of the response"` } diff --git a/quickstart/eino_assistant/pkg/tool/gitclone/gitclone.go b/quickstart/eino_assistant/pkg/tool/gitclone/gitclone.go index 235bd6e..0a3f006 100644 --- a/quickstart/eino_assistant/pkg/tool/gitclone/gitclone.go +++ b/quickstart/eino_assistant/pkg/tool/gitclone/gitclone.go @@ -174,8 +174,8 @@ const ( ) type GitCloneRequest struct { - Url string `json:"url" jsonschema:"description=The URL of the repository to clone"` - Action GitCloneAction `json:"action" jsonschema:"description=The action to perform, 'clone' or 'pull'"` + Url string `json:"url" jsonschema_description:"The URL of the repository to clone"` + Action GitCloneAction `json:"action" jsonschema_description:"The action to perform, 'clone' or 'pull'"` } type GitCloneResponse struct { diff --git a/quickstart/eino_assistant/pkg/tool/open/open.go b/quickstart/eino_assistant/pkg/tool/open/open.go index aa14f8c..32f7609 100644 --- a/quickstart/eino_assistant/pkg/tool/open/open.go +++ b/quickstart/eino_assistant/pkg/tool/open/open.go @@ -86,11 +86,11 @@ func (of *OpenFileToolImpl) Invoke(ctx context.Context, req OpenReq) (res OpenRe } type OpenReq struct { - URI string `json:"uri" jsonschema:"description=The uri of the file/dir/web url to open"` + URI string `json:"uri" jsonschema_description:"The uri of the file/dir/web url to open"` } type OpenRes struct { - Message string `json:"message" jsonschema:"description=The message of the operation"` + Message string `json:"message" jsonschema_description:"The message of the operation"` } func openURI(uri string) error { diff --git a/quickstart/eino_assistant/pkg/tool/task/task.go b/quickstart/eino_assistant/pkg/tool/task/task.go index 1784c93..920b530 100644 --- a/quickstart/eino_assistant/pkg/tool/task/task.go +++ b/quickstart/eino_assistant/pkg/tool/task/task.go @@ -36,34 +36,34 @@ const ( ) type Task struct { - ID string `json:"id" jsonschema:"description=id of the task"` - Title string `json:"title" jsonschema:"description=title of the task"` - Content string `json:"content" jsonschema:"description=content of the task"` - Completed bool `json:"completed" jsonschema:"description=completed status of the task"` - Deadline string `json:"deadline" jsonschema:"description=deadline of the task"` + ID string `json:"id" jsonschema_description:"id of the task"` + Title string `json:"title" jsonschema_description:"title of the task"` + Content string `json:"content" jsonschema_description:"content of the task"` + Completed bool `json:"completed" jsonschema_description:"completed status of the task"` + Deadline string `json:"deadline" jsonschema_description:"deadline of the task"` IsDeleted bool `json:"is_deleted" jsonschema:"-"` - CreatedAt string `json:"created_at" jsonschema:"description=created time of the task"` + CreatedAt string `json:"created_at" jsonschema_description:"created time of the task"` } type TaskRequest struct { - Action Action `json:"action" jsonschema:"description=action to perform, enum:add,update,delete,list"` - Task *Task `json:"task" jsonschema:"description=task to add, update, or delete"` - List *ListParams `json:"list" jsonschema:"description=list parameters"` + Action Action `json:"action" jsonschema_description:"action to perform, enum:add,update,delete,list"` + Task *Task `json:"task" jsonschema_description:"task to add, update, or delete"` + List *ListParams `json:"list" jsonschema_description:"list parameters"` } type ListParams struct { - Query string `json:"query" jsonschema:"description=query to search"` - IsDone *bool `json:"is_done" jsonschema:"description=filter by completed status"` - Limit *int `json:"limit" jsonschema:"description=limit the number of results"` + Query string `json:"query" jsonschema_description:"query to search"` + IsDone *bool `json:"is_done" jsonschema_description:"filter by completed status"` + Limit *int `json:"limit" jsonschema_description:"limit the number of results"` } type TaskResponse struct { - Status string `json:"status" jsonschema:"description=status of the response"` + Status string `json:"status" jsonschema_description:"status of the response"` - TaskList []*Task `json:"task_list" jsonschema:"description=list of tasks"` + TaskList []*Task `json:"task_list" jsonschema_description:"list of tasks"` - Error string `json:"error" jsonschema:"description=error message"` + Error string `json:"error" jsonschema_description:"error message"` } type TaskToolImpl struct { diff --git a/quickstart/todoagent/main.go b/quickstart/todoagent/main.go index 4c46cb0..1b729af 100644 --- a/quickstart/todoagent/main.go +++ b/quickstart/todoagent/main.go @@ -196,11 +196,11 @@ func (lt *ListTodoTool) Info(_ context.Context) (*schema.ToolInfo, error) { } type TodoUpdateParams struct { - ID string `json:"id" jsonschema:"description=id of the todo"` - Content *string `json:"content,omitempty" jsonschema:"description=content of the todo"` - StartedAt *int64 `json:"started_at,omitempty" jsonschema:"description=start time in unix timestamp"` - Deadline *int64 `json:"deadline,omitempty" jsonschema:"description=deadline of the todo in unix timestamp"` - Done *bool `json:"done,omitempty" jsonschema:"description=done status"` + ID string `json:"id" jsonschema_description:"id of the todo"` + Content *string `json:"content,omitempty" jsonschema_description:"content of the todo"` + StartedAt *int64 `json:"started_at,omitempty" jsonschema_description:"start time in unix timestamp"` + Deadline *int64 `json:"deadline,omitempty" jsonschema_description:"deadline of the todo in unix timestamp"` + Done *bool `json:"done,omitempty" jsonschema_description:"done status"` } type TodoAddParams struct {