simonw / simonw/llm

Question about library usage: passing list of role/messages to prompt

Open
#894 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
12.5k
Forks
998
Avg merge
3d 13h
Merged PRs (30d)
10

Description

Would you be open to this? Where we don't have to rely on llm's own conversational history, but can just supply a list of objects each representing a role/content/whatever?

It allows for some applications to use their own state of conversation, and able to change it however they see fit, before communicating the next prompt

I hacked in a method to do this, but didn't see it through. I'd want your opinions first.

--

For example, openai and anthropic's python library (well, API in general) allow you to specify an array of messages, giving you full control over the context history. It's this exact feature I want to leverage with llm, as llm has a lot of other conveniences! For now I'm just rolling w/ anthropic's library directly.. (for now).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. First review how llm currently manages conversational history and model prompts, then clarify the proposed role/content message interface with maintainers. Done would require an agreed design and tests covering caller-supplied conversation state.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.