Skip to content

Commit b075ae9

Browse files
test(test_amazing_vertex_completion.py): try to repro #10319
1 parent 31313dd commit b075ae9

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed

tests/local_testing/test_amazing_vertex_completion.py

+113
Original file line numberDiff line numberDiff line change
@@ -3478,3 +3478,116 @@ def test_litellm_api_base(monkeypatch, provider, route):
34783478

34793479
mock_client.assert_called()
34803480
assert mock_client.call_args.kwargs["url"].startswith("https://litellm.com")
3481+
3482+
3483+
def test_gemini_tool_calling():
3484+
load_vertex_ai_credentials()
3485+
litellm._turn_on_debug()
3486+
args = {
3487+
"messages": [
3488+
{
3489+
"content": "\n You are a helpful assistant who can help with questions on customers business or personal finances.\n Use the results from the available tools to answer the question.\n ",
3490+
"role": "system"
3491+
},
3492+
{
3493+
"content": "Hello",
3494+
"role": "user"
3495+
}
3496+
],
3497+
"max_completion_tokens": 1000,
3498+
"temperature": 0.0,
3499+
"tools": [
3500+
{
3501+
"type": "function",
3502+
"function": {
3503+
"name": "test_agent",
3504+
"description": "This tool helps find relevant help content",
3505+
"parameters": {
3506+
"properties": {
3507+
"state": {
3508+
"properties": {
3509+
"messages": {
3510+
"items": {
3511+
"type": "object"
3512+
},
3513+
"type": "array"
3514+
},
3515+
"conversation_id": {
3516+
"type": "string"
3517+
}
3518+
},
3519+
"required": [
3520+
"messages",
3521+
"conversation_id"
3522+
],
3523+
"type": "object"
3524+
},
3525+
"config": {
3526+
"description": "Configuration for a Runnable.",
3527+
"properties": {
3528+
"tags": {
3529+
"items": {
3530+
"type": "string"
3531+
},
3532+
"type": "array"
3533+
},
3534+
"metadata": {
3535+
"type": "object"
3536+
},
3537+
"callbacks": {
3538+
"anyOf": [
3539+
{"type": "array"},
3540+
{"type": "object"},
3541+
{"type": "null"}
3542+
],
3543+
},
3544+
"run_name": {
3545+
"type": "string"
3546+
},
3547+
"max_concurrency": {
3548+
"anyOf": [
3549+
{
3550+
"type": "integer"
3551+
},
3552+
{
3553+
"type": "null"
3554+
}
3555+
]
3556+
},
3557+
"recursion_limit": {
3558+
"type": "integer"
3559+
},
3560+
"configurable": {
3561+
"type": "object"
3562+
},
3563+
"run_id": {
3564+
"anyOf": [
3565+
{
3566+
"format": "uuid",
3567+
"type": "string"
3568+
},
3569+
{
3570+
"type": "null"
3571+
}
3572+
]
3573+
}
3574+
},
3575+
"type": "object"
3576+
},
3577+
"kwargs": {
3578+
"default": None,
3579+
"type": "object"
3580+
}
3581+
},
3582+
"required": [
3583+
"state",
3584+
"config"
3585+
],
3586+
"type": "object"
3587+
}
3588+
}
3589+
}
3590+
]
3591+
}
3592+
response = completion(model="vertex_ai/gemini-2.0-flash", **args)
3593+
print(response)

0 commit comments

Comments
 (0)