Add configurable LLM provider layer (Gemini, SiliconFlow, OpenAI-compatible)#8
Open
Albertchamberlain wants to merge 1 commit into
Open
Conversation
Introduce a provider adapter so FsExplorer can use Google Gemini or OpenAI-compatible APIs (SiliconFlow, OpenAI) via FS_EXPLORER_LLM_PROVIDER and related env vars. Google remains the default with native JSON schema output. OpenAI-compatible providers use response_format=json_object plus flexible action parsing for imperfect model output. Includes PROVIDERS.md, updated tests, and optional live integration test gated on SILICONFLOW_API_KEY.
963b296 to
51f8f66
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.
Summary
This adds a small LLM provider layer so FsExplorer can run on Google Gemini (default) or OpenAI-compatible APIs such as SiliconFlow and OpenAI.
FS_EXPLORER_LLM_PROVIDER=googleis the default).GoogleGeminiClientkeeps native JSON schema output;OpenAICompatibleClientusesresponse_format=json_objectwith Action schema hints in the system prompt.action_parser.pyrecovers common malformed JSON from weaker models (similar in spirit to the Ollama branch, but provider-agnostic).PROVIDERS.md, updated.env.example/ README, unit tests for config + agent init, optional live test gated onSILICONFLOW_API_KEY.Motivation
Several users (especially in regions where Gemini access is limited) want to run the agent on OpenAI-compatible hosted models. The existing
feat/ollama-qwen3-native-apibranch targets local Ollama specifically; this PR generalizes provider selection via environment variables without changing the exploration workflow.Test plan
pytest tests/test_agent.py tests/test_llm_config.py tests/test_models.py(30 passed)FS_EXPLORER_LLM_PROVIDER=google+GOOGLE_API_KEYpytest tests/test_llm_integration.pywithSILICONFLOW_API_KEYsetNotes
PROVIDERS.md).openaias a runtime dependency for the compatible client.