instructor_ex icon indicating copy to clipboard operation
instructor_ex copied to clipboard

Chat completion inconsistent (Ollama)

Open jamilabreu opened this issue 8 months ago • 2 comments

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
 >}

jamilabreu avatar Jun 20 '24 00:06 jamilabreu