[GH-ISSUE #2864] Read and write files (To allow for more types of AI models in Ollama) #1748

Closed
opened 2026-04-12 11:44:08 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @trymeouteh on GitHub (Mar 1, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2864

To my understanding it will seem Ollama can only support text chat based models and to my understand it could support more kinds of models by adding a reading files and writing files feature...

  • A way to have a model read one or more file on your system and be able to send it to the AI model to process.
  • A way for the AI model to return a file, by generating a file (Writing a file) onto the system and them being able to link it into the chat response.

To my understanding, this can allow Ollama to work with more model types such as text to image models, image to image models, text to audio models, audio to text models, audio to audio models, etc.

Originally created by @trymeouteh on GitHub (Mar 1, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2864 To my understanding it will seem Ollama can only support text chat based models and to my understand it could support more kinds of models by adding a reading files and writing files feature... - A way to have a model read one or more file on your system and be able to send it to the AI model to process. - A way for the AI model to return a file, by generating a file (Writing a file) onto the system and them being able to link it into the chat response. To my understanding, this can allow Ollama to work with more model types such as text to image models, image to image models, text to audio models, audio to text models, audio to audio models, etc.
Author
Owner

@pdevine commented on GitHub (Mar 1, 2024):

For passing a file, you can do that in the REPL by passing the filename which the client will read and then pass to the API. The API already supports this (in both the /api/chat and /api/generate` endpoints). We don't yet have a way for the LLM to return a file, but we'd have to support it down the road when we support other models like stable diffusion.

<!-- gh-comment-id:1973630379 --> @pdevine commented on GitHub (Mar 1, 2024): For passing a file, you can do that in the REPL by passing the filename which the client will read and then pass to the API. The API already supports this (in both the `/api/chat` and /api/generate` endpoints). We don't *yet* have a way for the LLM to return a file, but we'd have to support it down the road when we support other models like stable diffusion.
Author
Owner

@trymeouteh commented on GitHub (Mar 7, 2024):

Is it already possible to have a model read two or more files or just one file at a time in a chat request?

<!-- gh-comment-id:1984149870 --> @trymeouteh commented on GitHub (Mar 7, 2024): Is it already possible to have a model read two or more files or just one file at a time in a chat request?
Author
Owner

@pdevine commented on GitHub (Mar 7, 2024):

I'm realizing on rereading my response that I was not super clear. The API doesn't read the file per se, but you can pass images along in the request. In the API you can do that with:

curl http://localhost:11434/api/generate -d '{
  "model": "llama2",
  "prompt": "Why is the sky blue?",
  "images": [ ... <list of image data> ... ]
}'

Or you can do:

curl http://localhost:11434/api/chat -d '{
  "model": "llama2",
  "messages": [
    {
      "role": "user",
      "content": "why is the sky blue?",
      "images": [ ... <list of image data> ],
    }
  ]
}'

You can find more info in the docs.

I'm going to go ahead and close the issue, but feel free to keep commenting, or ask away in the discord.

<!-- gh-comment-id:1984217672 --> @pdevine commented on GitHub (Mar 7, 2024): I'm realizing on rereading my response that I was not super clear. The API doesn't read the file per se, but you can pass images along in the request. In the API you can do that with: ``` curl http://localhost:11434/api/generate -d '{ "model": "llama2", "prompt": "Why is the sky blue?", "images": [ ... <list of image data> ... ] }' ``` Or you can do: ``` curl http://localhost:11434/api/chat -d '{ "model": "llama2", "messages": [ { "role": "user", "content": "why is the sky blue?", "images": [ ... <list of image data> ], } ] }' ``` You can find more info in the [docs](https://github.com/ollama/ollama/blob/main/docs/api.md). I'm going to go ahead and close the issue, but feel free to keep commenting, or ask away in the discord.
Author
Owner

@trymeouteh commented on GitHub (Mar 8, 2024):

Is it possible to pass two or more files into any of the available models for Ollama? If so you can please provide an example without using curl but using the model chat?

<!-- gh-comment-id:1985762420 --> @trymeouteh commented on GitHub (Mar 8, 2024): Is it possible to pass two or more files into any of the available models for Ollama? If so you can please provide an example without using curl but using the model chat?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1748