Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# Google Gemini API Key
# LLM provider selection: google | siliconflow | openai
FS_EXPLORER_LLM_PROVIDER=google

# Optional model override (provider-specific default if unset)
# FS_EXPLORER_LLM_MODEL=gemini-3-flash-preview
# FS_EXPLORER_LLM_MODEL=Qwen/Qwen2.5-72B-Instruct

# Optional base URL override for OpenAI-compatible providers
# FS_EXPLORER_LLM_BASE_URL=https://api.siliconflow.cn/v1

# --- Google Gemini ---
# Get yours at: https://aistudio.google.com/apikey
GOOGLE_API_KEY=your_api_key_here
GOOGLE_API_KEY=your_google_api_key_here

# --- SiliconFlow (OpenAI-compatible) ---
# Get yours at: https://cloud.siliconflow.cn/account/ak
SILICONFLOW_API_KEY=your_siliconflow_api_key_here

# --- OpenAI (optional) ---
# OPENAI_API_KEY=your_openai_api_key_here

# Optional: dedicated key for langextract metadata mode.
# If unset, indexing will fall back to GOOGLE_API_KEY.
Expand Down
64 changes: 64 additions & 0 deletions PROVIDERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# LLM Provider Configuration

FsExplorer supports multiple LLM backends through a small provider adapter layer.

## Quick Start

### Google Gemini (default)

```bash
export FS_EXPLORER_LLM_PROVIDER=google
export GOOGLE_API_KEY=your_google_api_key
```

### SiliconFlow (OpenAI-compatible)

```bash
export FS_EXPLORER_LLM_PROVIDER=siliconflow
export SILICONFLOW_API_KEY=your_siliconflow_api_key
# Optional overrides
export FS_EXPLORER_LLM_MODEL=Qwen/Qwen2.5-72B-Instruct
export FS_EXPLORER_LLM_BASE_URL=https://api.siliconflow.cn/v1
# International endpoint: https://api.siliconflow.com/v1
```

Get a SiliconFlow API key at https://cloud.siliconflow.cn/account/ak

### OpenAI

```bash
export FS_EXPLORER_LLM_PROVIDER=openai
export OPENAI_API_KEY=your_openai_api_key
export FS_EXPLORER_LLM_MODEL=gpt-4o-mini
export FS_EXPLORER_LLM_BASE_URL=https://api.openai.com/v1
```

## Environment Variables

| Variable | Description |
|----------|-------------|
| `FS_EXPLORER_LLM_PROVIDER` | `google`, `siliconflow`, or `openai` (default: `google`) |
| `FS_EXPLORER_LLM_MODEL` | Model id override |
| `FS_EXPLORER_LLM_BASE_URL` | Base URL for OpenAI-compatible providers |
| `GOOGLE_API_KEY` | Google Gemini API key |
| `SILICONFLOW_API_KEY` | SiliconFlow API key |
| `OPENAI_API_KEY` | OpenAI API key |

## Architecture

```
FsExplorerAgent
-> llm.create_llm_client()
-> GoogleGeminiClient (native JSON schema)
-> OpenAICompatibleClient (SiliconFlow, OpenAI, ...)
```

Google Gemini uses native structured JSON output. OpenAI-compatible providers use `response_format=json_object` plus the Action JSON schema embedded in the system prompt, with flexible parsing for imperfect model output.

## Embeddings / Indexing

Vector indexing (`explore index --with-embeddings`) still uses Google Gemini embeddings by default via `GOOGLE_API_KEY`. Chat provider selection is independent of embedding configuration.

## Security

Never commit `.env` or real API keys. Use `.env.example` as a template only.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This video explains the architecture of the project and how to run it.

- 🔍 **6 Tools**: `scan_folder`, `preview_file`, `parse_file`, `read`, `grep`, `glob`
- 📄 **Document Support**: PDF, DOCX, PPTX, XLSX, HTML, Markdown (via Docling)
- 🤖 **Powered by**: Google Gemini 3 Flash with structured JSON output
- 🤖 **Multi-LLM**: Google Gemini, SiliconFlow, OpenAI-compatible APIs
- 💰 **Cost Efficient**: ~$0.001 per query with token tracking
- 🌐 **Web UI**: Real-time WebSocket streaming interface
- 📊 **Citations**: Answers include source references
Expand All @@ -45,13 +45,19 @@ pip install .

## Configuration

Create a `.env` file in the project root:
Create a `.env` file in the project root (see `.env.example`):

```bash
# Google Gemini (default)
FS_EXPLORER_LLM_PROVIDER=google
GOOGLE_API_KEY=your_api_key_here

# SiliconFlow (OpenAI-compatible)
# FS_EXPLORER_LLM_PROVIDER=siliconflow
# SILICONFLOW_API_KEY=your_api_key_here
```

Get your API key from [Google AI Studio](https://aistudio.google.com/apikey).
See [PROVIDERS.md](PROVIDERS.md) for all supported backends and model overrides.

## Usage

Expand Down Expand Up @@ -125,7 +131,7 @@ uv run explore --task "Look in data/large_acquisition/. What happens to employee

| Component | Technology |
|-----------|------------|
| LLM | Google Gemini 3 Flash |
| LLM | Google Gemini / SiliconFlow / OpenAI-compatible |
| Document Parsing | Docling (local, open-source) |
| Orchestration | LlamaIndex Workflows |
| CLI | Typer + Rich |
Expand All @@ -136,7 +142,8 @@ uv run explore --task "Look in data/large_acquisition/. What happens to employee

```
src/fs_explorer/
├── agent.py # Gemini client, token tracking
├── agent.py # Agent + tool registry
├── llm/ # Multi-provider LLM adapters
├── workflow.py # LlamaIndex workflow engine
├── fs.py # File tools: scan, parse, grep
├── models.py # Pydantic models for actions
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies = [
"duckdb>=1.0.0",
"fastapi>=0.115.0",
"google-genai>=1.55.0",
"openai>=1.60.0",
"langextract>=1.0.0",
"llama-index-workflows>=2.11.5",
"python-dotenv>=1.0.0",
Expand Down
Loading