mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-14 08:01:02 -07:00
- Introduced a new Hook type and hook() helper for strongly-typed SDK hooks. - Integrated runtime hooks into GeminiCliSession lifecycle (startup, close, and tool execution). - Added hooks option to GeminiCliAgentOptions. - Exported executeToolWithHooks from core to facilitate SDK integration. - Updated SDK_DESIGN.md to reflect implemented features and remaining tasks. - Added and re-recorded SDK integration tests for hooks.
11 lines
7.7 KiB
JSON
11 lines
7.7 KiB
JSON
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"functionCall":{"name":"add","args":{"a":5,"b":3}}}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7237,"candidatesTokenCount":5,"totalTokenCount":7242,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7237}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":5}]}}]}
|
|
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"I"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10157,"totalTokenCount":10157,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10157}]}},{"candidates":[{"content":{"parts":[{"text":" encountered an error when trying to add the two numbers. I will try again."}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10157,"totalTokenCount":10157,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10157}]}},{"candidates":[{"content":{"parts":[{"text":"\n\n"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10157,"totalTokenCount":10157,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10157}]}},{"candidates":[{"content":{"parts":[{"functionCall":{"name":"add","args":{"b":3,"a":5}}}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7259,"candidatesTokenCount":23,"totalTokenCount":7282,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7259}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":23}]}}]}
|
|
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"I am still encountering"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10220,"totalTokenCount":10220,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10220}]}},{"candidates":[{"content":{"parts":[{"text":" an error. I am not sure why the add tool is failing. I will try a"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10220,"totalTokenCount":10220,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10220}]}},{"candidates":[{"finishReason":"MALFORMED_FUNCTION_CALL"}],"usageMetadata":{"promptTokenCount":7299,"candidatesTokenCount":22,"totalTokenCount":7321,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7299}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":22}]}}]}
|
|
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"I am still encountering"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10220,"totalTokenCount":10220,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10220}]}},{"candidates":[{"content":{"parts":[{"text":" an error. I will try a different approach.\n"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10220,"totalTokenCount":10220,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10220}]}},{"candidates":[{"finishReason":"MALFORMED_FUNCTION_CALL"}],"usageMetadata":{"promptTokenCount":7299,"candidatesTokenCount":15,"totalTokenCount":7314,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7299}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":15}]}}]}
|
|
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"\nI apologize"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10226,"totalTokenCount":10226,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10226}]}},{"candidates":[{"content":{"parts":[{"text":", it seems I am having trouble with the `add` tool. I will"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10226,"totalTokenCount":10226,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10226}]}},{"candidates":[{"content":{"parts":[{"text":" try a different approach and use a shell command to calculate the sum.\n"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10226,"totalTokenCount":10226,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10226}]}},{"candidates":[{"content":{"parts":[{"functionCall":{"name":"run_shell_command","args":{"description":"Calculates the sum of 5 and 3 using bash.","command":"echo $((5+3))"}}}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7304,"candidatesTokenCount":60,"totalTokenCount":7364,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7304}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":60}]}}]}
|
|
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"I am still running"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10329,"totalTokenCount":10329,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10329}]}},{"candidates":[{"content":{"parts":[{"text":" into errors. I apologize, I am unable to calculate the sum at this time.\n"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10329,"totalTokenCount":10329,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10329}]}},{"candidates":[{"content":{"parts":[{"text":""}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7385,"candidatesTokenCount":22,"totalTokenCount":7407,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7385}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":22}]}}]}
|
|
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"functionCall":{"name":"add","args":{"a":5,"b":3}}}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7248,"candidatesTokenCount":5,"totalTokenCount":7253,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7248}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":5}]}}]}
|
|
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"8"}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7271,"candidatesTokenCount":1,"totalTokenCount":7272,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7271}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":1}]}}]}
|
|
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"I will calculate 5 + 3 for you."}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":8809,"candidatesTokenCount":11,"totalTokenCount":8850,"promptTokensDetails":[{"modality":"TEXT","tokenCount":8809}],"thoughtsTokenCount":30}},{"candidates":[{"content":{"parts":[{"functionCall":{"name":"add","args":{"a":5,"b":3}},"thoughtSignature":"EsEBCr4BAb4+9vuEbJ5fycmT6h3jmNfRvhtePUGfO2mV0ksh8oeV82QsvD1xiF0XEM7VBF2YNX2JJy/nYWOIHbSDjjZ1uR9NHTC4QVwSTTOwB7vGAGpBAt6pgiVEP0HiIom7mh9cCoxKzylLr+IIfhglhhEuEdVeEjJkFYFYZRWfPjUDMD+iVQhQqDcPoHjbPrnJe7vhFvkR7C8/NaY6MiETg2lWPjaABFLl7mTt3j8RL9HDPjdIAAPZ2fPSGDCNCUOLMQ=="}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":8809,"candidatesTokenCount":27,"totalTokenCount":8866,"promptTokensDetails":[{"modality":"TEXT","tokenCount":8809}],"thoughtsTokenCount":30}},{"candidates":[{"content":{"parts":[{"text":""}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":8809,"candidatesTokenCount":27,"totalTokenCount":8866,"promptTokensDetails":[{"modality":"TEXT","tokenCount":8809}],"thoughtsTokenCount":30}}]}
|
|
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"5 + 3 is 8."}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":8863,"candidatesTokenCount":8,"totalTokenCount":8892,"promptTokensDetails":[{"modality":"TEXT","tokenCount":8863}],"thoughtsTokenCount":21}},{"candidates":[{"content":{"parts":[{"text":"","thoughtSignature":"EokBCoYBAb4+9vuni05RduVlzmZamZyvbhsm1m43T8/mCWdW4oUVYoJjgjhLDEq4S+JdKeweDj+ZIkSinPKEloDcdFc3RbD2P08vEwaN8Mo459nh4+afuIvm+Rl1BQ8T5i874/ZzwyqwR19H/3SbSpwjZmqbdrmrlywULa/fEwE48XWFlSywn4azrmw="}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":8893,"candidatesTokenCount":8,"totalTokenCount":8922,"promptTokensDetails":[{"modality":"TEXT","tokenCount":8893}],"thoughtsTokenCount":21}}]}
|