Skip to content

Commit

Permalink
Fix error with ollama function results
Browse files Browse the repository at this point in the history
* llm-ollama.el (llm-provider-chat-request): Wrap contents via
json-encode, if not already a string.

Fixes #70.
  • Loading branch information
ultronozm committed Aug 28, 2024
1 parent dc98688 commit 33be006
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion llm-ollama.el
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ PROVIDER is the llm-ollama provider."
(setq messages
(mapcar (lambda (interaction)
`(("role" . ,(symbol-name (llm-chat-prompt-interaction-role interaction)))
("content" . ,(llm-chat-prompt-interaction-content interaction))))
("content" . ,(let ((content
(llm-chat-prompt-interaction-content interaction)))
(if (stringp content)
content
(json-encode content))))))
(llm-chat-prompt-interactions prompt)))
(when (llm-chat-prompt-context prompt)
(push `(("role" . "system")
Expand Down

0 comments on commit 33be006

Please sign in to comment.