From 539393070182c59b407dc0187dfbf2a791d6f811 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 16 Apr 2024 21:09:53 -0700 Subject: [PATCH] fix function calling prompt - ask llm to respond in fahrenheit --- litellm/tests/test_bedrock_completion.py | 5 ++++- litellm/tests/test_completion.py | 14 ++++++++++++-- litellm/tests/test_streaming.py | 14 ++++++++++++-- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/litellm/tests/test_bedrock_completion.py b/litellm/tests/test_bedrock_completion.py index 6827bc570c..4b1781cd93 100644 --- a/litellm/tests/test_bedrock_completion.py +++ b/litellm/tests/test_bedrock_completion.py @@ -252,7 +252,10 @@ def test_bedrock_claude_3_tool_calling(): } ] messages = [ - {"role": "user", "content": "What's the weather like in Boston today?"} + { + "role": "user", + "content": "What's the weather like in Boston today in fahrenheit?", + } ] response: ModelResponse = completion( model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0", diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index cbadb23c5d..6b382dc0d6 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -167,7 +167,12 @@ def test_completion_claude_3_function_call(): }, } ] - messages = [{"role": "user", "content": "What's the weather like in Boston today?"}] + messages = [ + { + "role": "user", + "content": "What's the weather like in Boston today in Fahrenheit?", + } + ] try: # test without max tokens response = completion( @@ -376,7 +381,12 @@ def test_completion_claude_3_function_plus_image(): ] tool_choice = {"type": "function", "function": {"name": "get_current_weather"}} - messages = [{"role": "user", "content": "What's the weather like in Boston today?"}] + messages = [ + { + "role": "user", + "content": "What's the weather like in Boston today in Fahrenheit?", + } + ] response = completion( model="claude-3-sonnet-20240229", diff --git a/litellm/tests/test_streaming.py b/litellm/tests/test_streaming.py index 098869a285..a18da18192 100644 --- a/litellm/tests/test_streaming.py +++ b/litellm/tests/test_streaming.py @@ -2252,7 +2252,12 @@ def test_completion_claude_3_function_call_with_streaming(): }, } ] - messages = [{"role": "user", "content": "What's the weather like in Boston today?"}] + messages = [ + { + "role": "user", + "content": "What's the weather like in Boston today in fahrenheit?", + } + ] try: # test without max tokens response = completion( @@ -2306,7 +2311,12 @@ async def test_acompletion_claude_3_function_call_with_streaming(): }, } ] - messages = [{"role": "user", "content": "What's the weather like in Boston today?"}] + messages = [ + { + "role": "user", + "content": "What's the weather like in Boston today in fahrenheit?", + } + ] try: # test without max tokens response = await acompletion(