Skip to content

Question about gollm's approach to messages #31

@myzie

Description

@myzie

Hi there @teilomillet,

Nice library! I was considering using it in one of my apps and after taking a closer look I had a question for you.

In my situation I'm handling long chat conversations sometimes, and so far I've been passing the user and assistant messages (as they accumulate) as separate JSON messages to the API. I see in the gollm implementation it is instead embedding the message history into a single user message:

https://github.com/teilomillet/gollm/blob/main/llm/memory.go#L174-L191

I'm using caching with the Anthropic API today, and this would potentially break message caching beyond the system prompt, which seems like one of the problems for me when considering using gollm.

Caching aside, have you found that there's little difference in the LLM behavior for this approach vs. passing each message as a separate JSON object?

Thanks for your feedback!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions