json_gemini.ts 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. // TODO: don't know why zod can not generate the same schema, need to fix it
  2. export const geminiNavigatorOutputSchema = {
  3. type: 'object',
  4. properties: {
  5. current_state: {
  6. type: 'object',
  7. description: 'Current state of the agent',
  8. properties: {
  9. evaluation_previous_goal: {
  10. type: 'string',
  11. },
  12. memory: {
  13. type: 'string',
  14. },
  15. next_goal: {
  16. type: 'string',
  17. },
  18. },
  19. required: ['evaluation_previous_goal', 'memory', 'next_goal'],
  20. },
  21. action: {
  22. type: 'array',
  23. items: {
  24. type: 'object',
  25. properties: {
  26. done: {
  27. type: 'object',
  28. properties: {
  29. text: {
  30. type: 'string',
  31. },
  32. success: {
  33. type: 'boolean',
  34. },
  35. },
  36. required: ['text', 'success'],
  37. nullable: true,
  38. },
  39. search_google: {
  40. type: 'object',
  41. properties: {
  42. intent: {
  43. type: 'string',
  44. description: 'purpose of this action',
  45. },
  46. query: {
  47. type: 'string',
  48. },
  49. },
  50. required: ['intent', 'query'],
  51. nullable: true,
  52. },
  53. go_to_url: {
  54. type: 'object',
  55. properties: {
  56. intent: {
  57. type: 'string',
  58. description: 'purpose of this action',
  59. },
  60. url: {
  61. type: 'string',
  62. },
  63. },
  64. required: ['intent', 'url'],
  65. nullable: true,
  66. },
  67. go_back: {
  68. type: 'object',
  69. properties: {
  70. intent: {
  71. type: 'string',
  72. description: 'purpose of this action',
  73. },
  74. },
  75. required: ['intent'],
  76. nullable: true,
  77. },
  78. wait: {
  79. type: 'object',
  80. properties: {
  81. intent: {
  82. type: 'string',
  83. description: 'purpose of this action',
  84. },
  85. seconds: {
  86. type: 'integer',
  87. },
  88. },
  89. required: ['intent', 'seconds'],
  90. nullable: true,
  91. },
  92. click_element: {
  93. type: 'object',
  94. properties: {
  95. intent: {
  96. type: 'string',
  97. description: 'purpose of this action',
  98. },
  99. index: {
  100. type: 'integer',
  101. },
  102. xpath: {
  103. type: 'string',
  104. nullable: true,
  105. },
  106. },
  107. required: ['intent', 'index'],
  108. nullable: true,
  109. },
  110. input_text: {
  111. type: 'object',
  112. properties: {
  113. intent: {
  114. type: 'string',
  115. description: 'purpose of this action',
  116. },
  117. index: {
  118. type: 'integer',
  119. },
  120. text: {
  121. type: 'string',
  122. },
  123. xpath: {
  124. type: 'string',
  125. nullable: true,
  126. },
  127. },
  128. required: ['intent', 'index', 'text'],
  129. nullable: true,
  130. },
  131. switch_tab: {
  132. type: 'object',
  133. properties: {
  134. intent: {
  135. type: 'string',
  136. description: 'purpose of this action',
  137. },
  138. tab_id: {
  139. type: 'integer',
  140. },
  141. },
  142. required: ['intent', 'tab_id'],
  143. nullable: true,
  144. },
  145. open_tab: {
  146. type: 'object',
  147. properties: {
  148. intent: {
  149. type: 'string',
  150. description: 'purpose of this action',
  151. },
  152. url: {
  153. type: 'string',
  154. },
  155. },
  156. required: ['intent', 'url'],
  157. nullable: true,
  158. },
  159. close_tab: {
  160. type: 'object',
  161. properties: {
  162. intent: {
  163. type: 'string',
  164. description: 'purpose of this action',
  165. },
  166. tab_id: {
  167. type: 'integer',
  168. },
  169. },
  170. required: ['intent', 'tab_id'],
  171. nullable: true,
  172. },
  173. cache_content: {
  174. type: 'object',
  175. properties: {
  176. intent: {
  177. type: 'string',
  178. description: 'purpose of this action',
  179. },
  180. content: {
  181. type: 'string',
  182. },
  183. },
  184. required: ['intent', 'content'],
  185. nullable: true,
  186. },
  187. scroll_down: {
  188. type: 'object',
  189. properties: {
  190. intent: {
  191. type: 'string',
  192. description: 'purpose of this action',
  193. },
  194. amount: {
  195. type: 'integer',
  196. nullable: true,
  197. },
  198. },
  199. required: ['intent', 'amount'],
  200. nullable: true,
  201. },
  202. scroll_up: {
  203. type: 'object',
  204. properties: {
  205. intent: {
  206. type: 'string',
  207. description: 'purpose of this action',
  208. },
  209. amount: {
  210. type: 'integer',
  211. nullable: true,
  212. },
  213. },
  214. required: ['intent', 'amount'],
  215. nullable: true,
  216. },
  217. send_keys: {
  218. type: 'object',
  219. properties: {
  220. intent: {
  221. type: 'string',
  222. description: 'purpose of this action',
  223. },
  224. keys: {
  225. type: 'string',
  226. },
  227. },
  228. required: ['intent', 'keys'],
  229. nullable: true,
  230. },
  231. scroll_to_text: {
  232. type: 'object',
  233. properties: {
  234. intent: {
  235. type: 'string',
  236. description: 'purpose of this action',
  237. },
  238. text: {
  239. type: 'string',
  240. },
  241. },
  242. required: ['intent', 'text'],
  243. nullable: true,
  244. },
  245. get_dropdown_options: {
  246. type: 'object',
  247. properties: {
  248. intent: {
  249. type: 'string',
  250. description: 'purpose of this action',
  251. },
  252. index: {
  253. type: 'integer',
  254. },
  255. },
  256. required: ['intent', 'index'],
  257. nullable: true,
  258. },
  259. select_dropdown_option: {
  260. type: 'object',
  261. properties: {
  262. intent: {
  263. type: 'string',
  264. description: 'purpose of this action',
  265. },
  266. index: {
  267. type: 'integer',
  268. },
  269. text: {
  270. type: 'string',
  271. },
  272. },
  273. required: ['intent', 'index', 'text'],
  274. nullable: true,
  275. },
  276. },
  277. required: [],
  278. },
  279. },
  280. },
  281. required: ['current_state', 'action'],
  282. };