if "function_call" find name

This commit is contained in:
WilliamEspegren 2023-09-17 19:02:50 +02:00
parent d2bdfecd96
commit 404af1be0f
No known key found for this signature in database
GPG key ID: 30E0CDDF1B5262CD
5 changed files with 272 additions and 2 deletions

View file

@ -2,16 +2,33 @@ from litellm import completion, stream_chunk_builder
import litellm
import os
user_message = "Write a short poem about the sky"
user_message = "What is the current weather in Boston?"
messages = [{"content": user_message, "role": "user"}]
function_schema = {
"name": "get_weather",
"description":
"gets the current weather",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description":
"The city and state, e.g. San Francisco, CA"
},
},
"required": ["location"]
},
}
def test_stream_chunk_builder():
litellm.api_key = os.environ["OPENAI_API_KEY"]
response = completion(
model="gpt-3.5-turbo",
messages=messages,
functions=[function_schema],
stream=True,
max_tokens=10,
)
chunks = []