[GH-ISSUE #1480] Q: Why Chat API does not include message in the response body? #26560

Closed
opened 2026-04-22 02:54:31 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @gluonfield on GitHub (Dec 12, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/1480

Originally assigned to: @BruceMacD on GitHub.

Why Chat API does not include message in the response body?

Generate API does include the response, is there any reason to omit it here?

Originally created by @gluonfield on GitHub (Dec 12, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/1480 Originally assigned to: @BruceMacD on GitHub. Why Chat API does not include message in the response body? Generate API does include the response, is there any reason to omit it here?
GiteaMirror added the feature request label 2026-04-22 02:54:31 -05:00
Author
Owner

@BruceMacD commented on GitHub (Dec 12, 2023):

Hi @AugustDev are you looking for the message in the final response body? Would you be able to give me an example? This is a new endpoint so I appreciate the feedback.

<!-- gh-comment-id:1852436936 --> @BruceMacD commented on GitHub (Dec 12, 2023): Hi @AugustDev are you looking for the message in the final response body? Would you be able to give me an example? This is a new endpoint so I appreciate the feedback.
Author
Owner

@rgaidot commented on GitHub (Dec 12, 2023):

the response structure for the endpoint /api/chat is not the same as /api/generate it's not response but message

/api/chat

{"model":"mistral","created_at":"2023-12-12T20:29:02.010018961Z","message":{"role":"assistant","content":"\n"},"done":false}

/api/generate

{"model":"llama2","created_at":"2023-12-12T20:32:21.667986258Z","response":"The","done":false}

It's not a bug

Best.

<!-- gh-comment-id:1852690311 --> @rgaidot commented on GitHub (Dec 12, 2023): the response structure for the endpoint `/api/chat` is not the same as `/api/generate` it's not _response_ but _message_ /api/chat `{"model":"mistral","created_at":"2023-12-12T20:29:02.010018961Z","message":{"role":"assistant","content":"\n"},"done":false} ` /api/generate `{"model":"llama2","created_at":"2023-12-12T20:32:21.667986258Z","response":"The","done":false}` It's not a bug Best.
Author
Owner

@BruceMacD commented on GitHub (Dec 12, 2023):

Thanks, I understand the feedback now

<!-- gh-comment-id:1852714891 --> @BruceMacD commented on GitHub (Dec 12, 2023): Thanks, I understand the feedback now
Author
Owner

@jmorganca commented on GitHub (Feb 20, 2024):

Hi @AugustDev, the chat api returns a message since it's an object (vs the response text), this is by design. Let me know if you encounter any more issues

<!-- gh-comment-id:1953343625 --> @jmorganca commented on GitHub (Feb 20, 2024): Hi @AugustDev, the chat api returns a `message` since it's an object (vs the response text), this is by design. Let me know if you encounter any more issues
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#26560