Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include file contents in llm chat #682

Open
jritsema opened this issue Dec 20, 2024 · 2 comments
Open

Include file contents in llm chat #682

jritsema opened this issue Dec 20, 2024 · 2 comments

Comments

@jritsema
Copy link

Curious, is there a way to inject the contents of a file while in the middle of a chat? If not, I'd love to be able to do something like !file foo.txt

@spm1001
Copy link

spm1001 commented Dec 29, 2024

Similarly I'd love to be able to start a chat with a corpus of input (text files, images), plus an initial prompt, then continue the conversation, but cat Screenshot\ 2024-12-12\ at\ 14.06.20.png | llm chat "describe this image and then let's talk about it" -a - -m gemini-2.0-flash-exp gives. (I'm assuming/hoping this will mean that I don't have to re-transmit the image for each 'turn' in the chat.)

Usage: llm chat [OPTIONS]
Try 'llm chat --help' for help.

Error: No such option: -a

@Grynn
Copy link

Grynn commented Jan 5, 2025

Something like @ instead of !file would be cleaner I think
Copilot in VSCode & Cursor do this, meaning they let you type @ to attach a file.

GitHub's issue editor uses # to reference issues and @ to reference people.

One way to do this might be an additional hook: prepare-prompt, which allows plugins to modify a prompt before it is executed by the model. The context could/should include file attachments, model id etc. Something like:

context:
  attachments:
    - { filename, mimeType, handle }
  model-id:
  model-name:
  prompt:
  conversation id: #if continuing an existing conversation.

You'd need handle & mimetype for when the input is not a file on disk, but a pipe.

Then people can make and activate their own plugins like:

  • llm-ctx-attach-files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants