Feat/venice provider v1#9
Draft
the-harry wants to merge 8 commits into
Draft
Conversation
The venice extra reuses the openai client since Venice is OpenAI-compatible (no point pulling the venice-ai SDK, it wants pydantic 2 which clashes with our langchain pin). onnxruntime is pinned to a wheel that actually loads on hardened kernels, and setuptools is capped below 81 because the TUI still imports pkg_resources.
New llm_provider switch (openai or venice), a venice_api_key read from VENICE_API_KEY and kept out of the saved file, and a VeniceSettings block for the model, base URL and web search. The missing-key warning only fires for the active provider now, and a broken chromadb import no longer takes the whole app down.
VeniceProvider wraps ChatOpenAI and points it at Venice's OpenAI-compatible endpoint. It folds enable_web_search into venice_parameters and drops null fields from the request body since Venice rejects them. build_llm() picks the backend from config.
langchain 0.0.266 still uses the old functions/function_call format, but Venice only accepts tools/tool_calls and 400s on the legacy keys. The provider now translates both ways: outgoing functions to tools, incoming tool_calls back to function_call, and it rewrites the message history so tool results go back as role tool with a tool_call_id. That's enough for OpenAIFunctionsAgent to drive Venice tools. Left a stub where x402 wallet auth would hook in.
make_llm() goes through build_llm() now so the configured provider is actually used by the bundled agents and the retrieval tool. They also stop blowing up when the Wikipedia tool isn't installed. Dropped a stray debug print.
Opening the manual with no docs/index.md threw an uncaught FileNotFoundError and killed the app. Catch it and show a fallback. instrukt/docs is generated, so it's fine for it to be missing in a dev checkout.
Add a commented config.example.yml covering both providers and how keys are handled, and a Venice section in the README with the model, web search and a note to use a local embedding for indexing.
Unit tests for the request params, web search, null stripping, the tool-call and message-history translation, and the factory, plus a live end-to-end tool-calling test that's skipped without a key. Also fixed two stale tests that were already failing on master.
89a9490 to
1668018
Compare
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.
No description provided.