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

@ -1158,6 +1158,10 @@ def stream_chunk_builder(chunks: list):
# Extract the "content" strings from the nested dictionaries within "choices"
content_list = []
if "function_call" in chunks[0]["choices"][0]["delta"]:
function_call_name = chunks[0]["choices"][0]["delta"]["function_call"]["name"]
print(function_call_name)
for chunk in chunks:
choices = chunk["choices"]
for choice in choices: