-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
bugSomething isn't workingSomething isn't working
Description
After making changes to the pom.xml / microprofile-config.properties to make the example use Ollama (see #23) calls to the Liberty example result in 400 response code being returned from Ollama.
I enabled log-requests/responses as follows in the microprofile-config.properties file:
dev.langchain4j.plugin.chat-model.config.logRequests=true
dev.langchain4j.plugin.chat-model.config.logResponses=true
I used the LLM request that was output into the logs to create the following direct call to Ollama:
curl -X POST http://localhost:11434/api/chat -H 'Content-Type: application/json' -d '
{
"messages" : [ {
"role" : "system",
"content" : "You are a customer support agent of a car rental company named Miles of Smiles. Before providing information about booking or canceling a booking, you MUST always check: booking number, customer name and surname. You should not answer to any request not related to car booking or Miles of Smiles company general information. When a customer wants to cancel a booking, you must check his name and the Miles of Smiles cancellation policy first. Any cancelation request must comply with cancellation policy both for the delay and the duration. Today is 2025-07-04. "
}, {
"role" : "user",
"content" : "hello, whats up?"
}, {
"role" : "user",
"content" : "hello, whats up?"
} ],
"options" : {
"stop" : [ ]
},
"stream" : false
}
'
The above call returns:
{"error":"model is required"}
I hand edited the above request to add a “model” key/value:
curl -X POST http://localhost:11434/api/chat -H 'Content-Type: application/json' -d '
{
"model" : "llama3.2",
"messages" : [ {
"role" : "system",
"content" : "You are a customer support agent of a car rental company named Miles of Smiles. Before providing information about booking or canceling a booking, you MUST always check: booking number, customer name and surname. You should not answer to any request not related to car booking or Miles of Smiles company general information. When a customer wants to cancel a booking, you must check his name and the Miles of Smiles cancellation policy first. Any cancelation request must comply with cancellation policy both for the delay and the duration. Today is 2025-07-04. "
}, {
"role" : "user",
"content" : "hello, whats up?"
}, {
"role" : "user",
"content" : "hello, whats up?"
} ],
"options" : {
"stop" : [ ]
},
"stream" : false
}
'
and the call now properly returns:
{"model":"llama3.2","created_at":"2025-07-04T16:08:41.3829Z","message":{"role":"assistant","content":"Hello! I'm here to help you with any questions or concerns you have about your car rental experience with Miles of Smiles. What can I assist you with today? Are you looking to book a new rental, or perhaps need assistance with an existing booking?"},"done_reason":"stop","done":true,"total_duration":785736791,"load_duration":69680916,"prompt_eval_count":149,"prompt_eval_duration":99196625,"eval_count":53,"eval_duration":615946666}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working