File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
python/packages/autogen-ext/src/autogen_ext/models/ollama Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -806,15 +806,21 @@ async def create_stream(
806806 completion_tokens = chunk .eval_count
807807 else :
808808 completion_tokens = 0
809- elif len (content_chunks ) > 1 :
809+ elif len (content_chunks ) > 0 :
810810 content = "" .join (content_chunks )
811811 if chunk and chunk .eval_count :
812812 completion_tokens = chunk .eval_count
813813 else :
814814 completion_tokens = 0
815+ elif len (full_tool_calls ) > 0 :
816+ content = full_tool_calls
817+ completion_tokens = chunk .eval_count if chunk and chunk .eval_count else 0
818+ elif normalize_stop_reason (stop_reason ) == "stop" :
819+ content = ""
820+ completion_tokens = 0
815821 else :
822+ content = []
816823 completion_tokens = 0
817- content = full_tool_calls
818824
819825 usage = RequestUsage (
820826 prompt_tokens = prompt_tokens ,
You can’t perform that action at this time.
0 commit comments