Skip to content

Commit

Permalink
Ollama part2 (#356)
Browse files Browse the repository at this point in the history
Co-authored-by: Tedfulk <[email protected]>
  • Loading branch information
jxnl and Tedfulk authored Jan 23, 2024
1 parent bd837bb commit 23a3abb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions instructor/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ def dump_message(message: ChatCompletionMessage) -> ChatCompletionMessageParam:
"role": message.role,
"content": message.content or "",
}
if message.tool_calls is not None:
if hasattr(message, "tool_calls") and message.tool_calls is not None:
ret["tool_calls"] = message.model_dump()["tool_calls"]
ret["content"] += json.dumps(message.model_dump()["tool_calls"])
if message.function_call is not None:
if hasattr(message, "function_call") and message.function_call is not None:
ret["content"] += json.dumps(message.model_dump()["function_call"])
return ret

Expand Down

0 comments on commit 23a3abb

Please sign in to comment.