Skip to content

Have you considered using embedding models? #2584

Closed

Description

@arturo-source

Proposal: Embedding models are cheaper and faster than LLMs. I thought that opencode could first ask the embedding model which part of the code responds better to the prompt, and then send these pieces of code to the LLM.

Drawback: The only limitation is that you have to first index the whole codebase, you can either send the entire files or use the LSP to get smaller code blocks. Then, save the vectors into a database, and you are good to go, you can ask first the embedding model which parts of the code fit better.

Options: There are some embedding models that can be run locally, so you might not depend on external providers, but also there are good embedding models from google or openai.

Maybe you already do that, but I haven't seen anything quick-reviewing the code, or maybe you have already considered that and it was not such a good idea, Thanks for the incredible project!

Activity

  1. github-actions commented on Sep 13, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    • Is there a repository map or RAG feature? #2108: Discusses RAG features that "index the whole codebase with embedding LLM" and repository mapping, which is very similar to your proposal for using embedding models to index and retrieve relevant code sections

    Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Dec 28, 2025

    @rekram1-node
    Collaborator

    [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

  3. K0IN commented on Dec 28, 2025

    @K0IN

    Hei even if you don't implement this, could someone explain, how the indexing works rn and why it is not needed to (schematic) fast find relevant text?

  4. MrDoe commented on May 28, 2026

    @MrDoe

    We could save a massive amount of tokens if RAG with embedding models would be implemented correctly. Such models can easily run locally on modern CPUs and they are much faster than standard LLMs. I'm considering creating an Opencode plugin with this functionality.

  5. MrDoe commented on May 29, 2026

    @MrDoe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions