11{
2- "tools" : [
3- {
4- "tags" : [
5- " LlamaIndex"
6- ],
7- "runnables" : {
8- "LlamaIndex" : {
9- "genericableId" : " llama_index.rag.toolkit" ,
10- "fitableId" : " embedding_choice_selector"
11- }
12- },
13- "schema" : {
14- "name" : " embedding_choice_selector" ,
15- "description" : " Embedding selector that chooses one out of many options." ,
16- "parameters" : {
17- "type" : " object" ,
18- "properties" : {
19- "choice" : {
20- "title" : " Choice" ,
21- "type" : " array" ,
22- "items" : {
23- "type" : " string"
24- }
25- },
26- "query_str" : {
27- "title" : " Query Str" ,
28- "type" : " string"
29- },
30- "model_name" : {
31- "type" : " string" ,
32- "description" : " model_name"
33- },
34- "api_key" : {
35- "type" : " string" ,
36- "description" : " api_key"
37- },
38- "api_base" : {
39- "type" : " string" ,
40- "description" : " api_base"
2+ "version" : " 1.0.0" ,
3+ "definitionGroups" : [ {
4+ "name" : " llm_selector_tools" ,
5+ "summary" : " LLM选择器工具组" ,
6+ "description" : " 基于嵌入相似度的智能选择器工具,用于从多个选项中选择与查询最相关的选项。支持配置不同的嵌入模型和API端点。" ,
7+ "extensions" : { },
8+ "definitions" : [ {
9+ "schema" : {
10+ "name" : " EmbeddingChoiceSelectorTool" ,
11+ "description" : " 嵌入选择器,从多个选项中选择一个。输入选项列表和查询字符串,返回选择结果列表。" ,
12+ "parameters" : {
13+ "type" : " object" ,
14+ "properties" : {
15+ "choice" : {
16+ "defaultValue" : " " ,
17+ "description" : " 可选项列表" ,
18+ "name" : " choice" ,
19+ "type" : " array" ,
20+ "items" : {
21+ "type" : " string"
22+ },
23+ "example" : " "
4124 },
42- "prompt" : {
43- "type" : " string" ,
44- "description" : " prompt"
25+ "query_str" : {
26+ "defaultValue" : " " ,
27+ "description" : " 查询字符串" ,
28+ "name" : " query_str" ,
29+ "type" : " string" ,
30+ "example" : " "
4531 },
46- "mode" : {
47- "type" : " string" ,
48- "description" : " mode"
32+ "options" : {
33+ "defaultValue" : " " ,
34+ "description" : " 嵌入选择器配置" ,
35+ "name" : " options" ,
36+ "type" : " object" ,
37+ "properties" : {
38+ "api_key" : {
39+ "type" : " string"
40+ },
41+ "model_name" : {
42+ "type" : " string"
43+ },
44+ "api_base" : {
45+ "type" : " string"
46+ }
47+ },
48+ "example" : " " ,
49+ "required" : [ " api_key" , " model_name" , " api_base" ]
4950 }
5051 },
51- "required" : [
52- " choice" ,
53- " query_str"
54- ]
52+ "required" : [ " choice" , " query_str" , " options" ]
5553 },
56- "return" : {
57- "title" : " The Selected Choice." ,
58- "type" : " array" ,
59- "items" : {
60- "title" : " SingleSelection" ,
61- "description" : " A single selection of a choice." ,
62- "type" : " object" ,
63- "properties" : {
64- "index" : {
65- "title" : " Index" ,
66- "type" : " integer"
54+ "order" : [ " choice" , " query_str" , " options" ],
55+ "return" : {
56+ "type" : " array" ,
57+ "items" : {
58+ "type" : " object" ,
59+ "properties" : {
60+ "content" : {
61+ "type" : " string"
6762 },
68- "reason" : {
69- "title" : " Reason" ,
70- "type" : " string"
63+ "score" : {
64+ "type" : " number"
65+ }
66+ }
67+ },
68+ "convertor" : " "
69+ }
70+ }
71+ } ]
72+ } ],
73+ "toolGroups" : [ {
74+ "name" : " default" ,
75+ "summary" : " 默认工具组" ,
76+ "description" : " 包含嵌入选择器工具的默认工具组,提供基于语义相似度的智能选择功能。" ,
77+ "extensions" : { },
78+ "definitionGroupName" : " llm_selector_tools" ,
79+ "tools" : [ {
80+ "namespace" : " embedding_choice_selector" ,
81+ "schema" : {
82+ "name" : " EmbeddingChoiceSelectorTool" ,
83+ "description" : " 基于嵌入相似度的智能选择器,通过计算查询字符串与选项列表的语义相似度,返回最相关的选项及其相似度分数。" ,
84+ "parameters" : {
85+ "type" : " object" ,
86+ "properties" : {
87+ "choice" : {
88+ "name" : " choice" ,
89+ "description" : " 待选择的选项列表,工具将计算每个选项与查询字符串的语义相似度" ,
90+ "type" : " array" ,
91+ "items" : {
92+ "type" : " string"
7193 }
7294 },
73- "required" : [
74- " index" ,
75- " reason"
76- ]
77- }
95+ "query_str" : {
96+ "name" : " query_str" ,
97+ "description" : " 查询字符串,用于与选项列表进行语义相似度匹配" ,
98+ "type" : " string"
99+ },
100+ "options" : {
101+ "name" : " options" ,
102+ "description" : " 嵌入模型配置参数,包括API密钥、模型名称和API基础URL" ,
103+ "type" : " object" ,
104+ "properties" : {
105+ "api_key" : {
106+ "description" : " 用于访问嵌入模型的API密钥" ,
107+ "type" : " string"
108+ },
109+ "model_name" : {
110+ "description" : " 要使用的嵌入模型名称" ,
111+ "type" : " string"
112+ },
113+ "api_base" : {
114+ "description" : " 嵌入模型API的基础URL地址" ,
115+ "type" : " string"
116+ }
117+ },
118+ "required" : [ " api_key" , " model_name" , " api_base" ]
119+ }
120+ },
121+ "required" : [ ]
78122 },
79- "parameterExtensions" : {
80- "config" : [
81- " model_name" ,
82- " api_key" ,
83- " api_base" ,
84- " prompt" ,
85- " mode"
86- ]
123+ "order" : [ " choice" , " query_str" , " options" ],
124+ "return" : {
125+ "name" : " selection_results" ,
126+ "description" : " 返回选择结果列表,包含每个选项的内容和对应的相似度分数,按相似度降序排列" ,
127+ "type" : " array" ,
128+ "items" : {
129+ "type" : " object" ,
130+ "properties" : {
131+ "content" : {
132+ "description" : " 选项的文本内容" ,
133+ "type" : " string"
134+ },
135+ "score" : {
136+ "description" : " 该选项与查询字符串的语义相似度分数(0-1之间,分数越高表示越相似)" ,
137+ "type" : " number"
138+ }
139+ }
140+ },
141+ "convertor" : " "
87142 }
88- }
89- }
90- ]
143+ },
144+ "runnables" : {
145+ "FIT" : {
146+ "genericableId" : " llama.tools.embedding_choice_selector" ,
147+ "fitableId" : " default"
148+ }
149+ },
150+ "extensions" : {
151+ "tags" : [ " llama" ]
152+ },
153+ "definitionName" : " EmbeddingChoiceSelectorTool"
154+ } ]
155+ } ]
91156}
0 commit comments