Rebuild omop-llm on any-llm, with oa-configurator 1.0 compatibility - #2
Draft
nicoloesch wants to merge 15 commits into
Draft
Rebuild omop-llm on any-llm, with oa-configurator 1.0 compatibility#2nicoloesch wants to merge 15 commits into
nicoloesch wants to merge 15 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR is predominantly the any-llm rewrite. The means rebuilding
omop-llmas the shared chat/embedding contract for the whole OMOP stack, replacing five repos' worth of independently hand-rolled provider backends (Ollama-specific clients, OpenAI-compat wrappers, Anthropic wrappers, a bespokeModelBackendABC ingroundcrew, native/api/chatincava-nlp-shard) with one interface.oa-configurator1.0 is required to configure LLMs and store them in the configuration. This is essentially functionality for this module.any-llm rewrite
ModelBackend(backend.py): one sync+async class wrapping Mozilla'sany-llmSDKcomplete/async_complete,embed_texts/async_embed_texts,extract/async_extract(native structured output, noinstructordependency required),dimensions/async_dimensions,is_available/async_is_available.ollama,llamacpp,vllm(local/self-hosted) andopenai,anthropic,gemini(cloud).any-llmsupports roughly 50 with various different capabilities.ModelCapabilities(capabilities.py):streaming,embeddings,extended_thinkingread from any-llm's own metadata;tool_use/structured_outputdeclared byomop_llmitself, since any-llm has no equivalentomop_llm.embeddings:EmbeddingRole(DOCUMENT/QUERY) + prefix application for asymmetric embedding models (nomic-embed-text, E5, BGE, ...)omop-embKNOWN_EMBEDDING_PREFIXESflags an unrecognized configured prefix to prevent model prefix injectionproviders.canonical_model_name()normalizes a model name across providers, and rejects Ollama's mutable:latesttagstructured.py:instructor-based fallback for structured extraction, kept out ofbackend.pyso importingomop_llmnever requires the optionalinstructordependency.instructor's own provider-builder source rather than assumed:ollamais unsafe to route through it (instructor's Ollama builder uses the OpenAI-compat shim, not native/api/chat)llamacpp/vllmhave no dedicated builder there;anthropic/geminiaren't offered here either. Not wired in as a silent alternative for every provider.OmopLlmError,UnsupportedProviderError,UnsupportedCapabilityError,NoParsedOutputError.