instructor_ex
instructor_ex copied to clipboard
Chat completion inconsistent (Ollama)
Running chat_completion on Ollama sometimes works, but mostly returns a "can't be blank" error
messages = [
%{role: "user", content: "Who were the first three president of the United States?"}
]
Instructor.chat_completion(
[
messages: messages,
mode: :json,
model: "llama3",
response_model: %{content: :string}
],
api_key: "ollama",
api_url: "http://localhost:11434",
http_options: [receive_timeout: 60000]
)
{:error,
#Ecto.Changeset<
action: nil,
changes: %{},
errors: [content: {"can't be blank", [validation: :required]}],
data: %{},
valid?: false
>}