Add optional OpenRouter provider for embeddings/search pipeline#133
Add optional OpenRouter provider for embeddings/search pipeline#133jamiequint wants to merge 2 commits intotobi:mainfrom
Conversation
f9605d7 to
370e81d
Compare
|
I feel like making this specific for OpenRouter reduces the usefulness of this PR. OpenRouter is itself OpenAI-compatible, so it would make better sense to map this PR around the OpenAI-spec, not OpenRouter's implementation of it. A rename of accepted environment variables is all that is required, really:- For I see you have other environment variables, too:- The first three would easily map to I'm not sure the purpose of the |
370e81d to
cbb44e2
Compare
|
@alexleach Thanks for the feedback. These are OpenRouter-specific metadata fields and aren’t required for inference, so removing them seems reasonable: QMD_OPENROUTER_APP_NAME I went ahead and did that. On the broader point about generalizing this away from OpenRouter to OpenAI: there isn’t anything in the code that requires OpenAI embeddings specifically. This implementation allows users to choose non-OpenAI embedding models via Because of that, names like |
|
Thanks for the response. What I meant was the protocol itself is basically OpenAI's. From https://openrouter.ai/docs/api/reference/overview:-
So, while not identical, they are "very similar", and one PR could satisfy both OpenAI and OpenRouter. Being OpenAI who designed the API, I would have thought naming it that way would be more applicable. Personally, I run qmd's default models in Docker Model Runner, so that openclaw running in docker can use qmd with GPU acceleration on my Mac. Docker Model Runner also conforms to the OpenAI Chat API. So, I myself use neither OpenAI or OpenRouter, but your PR would presumably cover my use-case too. |
|
There are at least a couple of other implementations of this as well:-
I'm hoping one of them gets merged so I don't have to rely on a fork of a fork, which is what I'm doing now... |
|
I needed a patch to get this branch working 5964419, but it works --- second one I tried to get going |
|
I also had to kludge in a better rerank because OpenRouter doesn't currently support it |
Summary
QMD_LLM_PROVIDERwithlocalas the default.OpenRouterLLMbackend for embeddings, query expansion, and reranking.QMD_OPENROUTER_API_KEY(preferred)OPENROUTER_API_KEYQMD_OPENROUTER_API_KEY_FILE(defaults to~/.config/qmd/openrouter.key)Testing