Different embedding model families need different prompt prefixes — Gemini wants "task: ... | query: ..." and "title: ... | text: ...", e5 wants "query: ..." / "passage: ...", and using the wrong one silently degrades retrieval quality. Add EMBEDDING_PROMPT_STYLE (gemini/e5/raw) so the prefix matches the chosen model. Defaults: gemini for OpenRouter (matches the existing default google/gemini-embedding-001), e5 for the local provider (matches the recommended multilingual-e5-large setup). Both override via env var or constructor. Update README and .env.example to recommend intfloat/multilingual- e5-large served by HuggingFace Text Embeddings Inference (one docker run) as the Turkish-optimized local setup, with a clear env var reference table. Ollama and OpenRouter remain documented as alternatives. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
147 lines
5.6 KiB
Bash
147 lines
5.6 KiB
Bash
# OAuth Configuration for Clerk + Google
|
|
# Copy this file to .env and fill in your actual values
|
|
|
|
# =============================================================================
|
|
# AUTHENTICATION SETTINGS
|
|
# =============================================================================
|
|
|
|
# Enable/disable authentication (set to "true" to enable OAuth)
|
|
ENABLE_AUTH=false
|
|
|
|
# =============================================================================
|
|
# CLERK CONFIGURATION
|
|
# =============================================================================
|
|
|
|
# Clerk API keys (get from https://dashboard.clerk.com/)
|
|
CLERK_SECRET_KEY=sk_test_your_secret_key_here
|
|
CLERK_PUBLISHABLE_KEY=pk_test_your_publishable_key_here
|
|
|
|
# OAuth Redirect URLs
|
|
CLERK_OAUTH_REDIRECT_URL=http://localhost:8000/auth/callback
|
|
CLERK_FRONTEND_URL=http://localhost:3000
|
|
|
|
# Clerk domain issuer (usually auto-configured)
|
|
CLERK_ISSUER=https://your-clerk-domain.clerk.accounts.dev
|
|
CLERK_DOMAIN=your-clerk-domain
|
|
|
|
# =============================================================================
|
|
# GOOGLE OAUTH SETTINGS
|
|
# =============================================================================
|
|
# Note: Google OAuth is configured through Clerk dashboard
|
|
# You need to:
|
|
# 1. Go to Clerk Dashboard > Social Connections
|
|
# 2. Enable Google provider
|
|
# 3. Add your Google OAuth client ID and secret
|
|
# 4. Configure redirect URIs in Google Console
|
|
|
|
# =============================================================================
|
|
# STRIPE CONFIGURATION (for payments/subscriptions)
|
|
# =============================================================================
|
|
|
|
STRIPE_SECRET=sk_test_your_stripe_secret_key_here
|
|
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here
|
|
|
|
# =============================================================================
|
|
# SERVER CONFIGURATION
|
|
# =============================================================================
|
|
|
|
# CORS origins (comma-separated list)
|
|
ALLOWED_ORIGINS=http://localhost:3000,http://localhost:8000,https://yourdomain.com
|
|
|
|
# Server settings
|
|
HOST=0.0.0.0
|
|
PORT=8000
|
|
LOG_LEVEL=info
|
|
|
|
# Base URL for the application (used for OAuth callbacks and API URLs)
|
|
BASE_URL=http://localhost:8000
|
|
|
|
# JWT Secret for MCP token generation
|
|
JWT_SECRET_KEY=your_jwt_secret_key_here
|
|
|
|
# =============================================================================
|
|
# MCP SERVER SETTINGS
|
|
# =============================================================================
|
|
|
|
# Additional MCP server configuration can go here
|
|
# For example, rate limiting, feature flags, etc.
|
|
|
|
# Example: Rate limiting
|
|
# MAX_REQUESTS_PER_MINUTE=60
|
|
# BURST_CAPACITY=20
|
|
|
|
# =============================================================================
|
|
# SEMANTIC SEARCH SETTINGS (Optional)
|
|
# =============================================================================
|
|
|
|
# Embedding provider for the semantic_search tool.
|
|
# Pick exactly one of: OpenRouter (hosted) or Local (your own server).
|
|
|
|
# --- Option A: OpenRouter (hosted, default) -----------------------------------
|
|
# Get your API key from: https://openrouter.ai/keys
|
|
# If neither this nor EMBEDDING_PROVIDER=local is set, semantic search is off.
|
|
OPENROUTER_API_KEY=sk-or-v1-your_openrouter_api_key_here
|
|
|
|
# Optional: override the OpenRouter embedding model and dimension.
|
|
# Defaults: google/gemini-embedding-001 at 3072 dims (paid on OpenRouter).
|
|
# Pick any model from https://openrouter.ai/models?modality=embedding
|
|
# and set the dimension to that model's output size — they must match.
|
|
# OPENROUTER_EMBEDDING_MODEL=google/gemini-embedding-001
|
|
# OPENROUTER_EMBEDDING_DIMENSION=3072
|
|
|
|
# --- Option B: Local OpenAI-compatible server (no API key required) ----------
|
|
# Recommended for Turkish: intfloat/multilingual-e5-large served by HuggingFace
|
|
# Text Embeddings Inference (TEI). One-line setup:
|
|
#
|
|
# docker run -p 8080:80 ghcr.io/huggingface/text-embeddings-inference:latest \
|
|
# --model-id intfloat/multilingual-e5-large
|
|
#
|
|
# Then uncomment the block below. Other model families work too — set
|
|
# EMBEDDING_PROMPT_STYLE to match: e5 / gemini / raw.
|
|
#
|
|
# EMBEDDING_PROVIDER=local
|
|
# LOCAL_EMBEDDING_BASE_URL=http://localhost:8080/v1
|
|
# LOCAL_EMBEDDING_MODEL=intfloat/multilingual-e5-large
|
|
# LOCAL_EMBEDDING_DIMENSION=1024
|
|
# EMBEDDING_PROMPT_STYLE=e5
|
|
# LOCAL_EMBEDDING_API_KEY= # most local servers ignore this
|
|
#
|
|
# Ollama fallback (if you prefer Ollama and don't need top Turkish quality):
|
|
# ollama serve && ollama pull nomic-embed-text
|
|
# EMBEDDING_PROVIDER=local
|
|
# LOCAL_EMBEDDING_BASE_URL=http://localhost:11434/v1
|
|
# LOCAL_EMBEDDING_MODEL=nomic-embed-text
|
|
# LOCAL_EMBEDDING_DIMENSION=768
|
|
# EMBEDDING_PROMPT_STYLE=raw # nomic uses its own search_query/search_document
|
|
|
|
# =============================================================================
|
|
# USAGE INSTRUCTIONS
|
|
# =============================================================================
|
|
|
|
# 1. Copy this file to .env:
|
|
# cp .env.example .env
|
|
|
|
# 2. Get Clerk credentials:
|
|
# - Sign up at https://clerk.com/
|
|
# - Create a new application
|
|
# - Go to API Keys tab
|
|
# - Copy Secret Key and Publishable Key
|
|
|
|
# 3. Configure Google OAuth in Clerk:
|
|
# - In Clerk Dashboard, go to Social Connections
|
|
# - Enable Google provider
|
|
# - Get Google OAuth credentials from Google Console
|
|
# - Add redirect URI: http://localhost:8000/auth/callback
|
|
|
|
# 4. Update OAuth URLs:
|
|
# - Set CLERK_OAUTH_REDIRECT_URL to your callback URL
|
|
# - Set CLERK_FRONTEND_URL to your frontend application URL
|
|
|
|
# 5. Enable authentication:
|
|
# - Set ENABLE_AUTH=true
|
|
|
|
# 6. Test the OAuth flow:
|
|
# - Start server: uvicorn asgi_app:app --reload
|
|
# - Visit: http://localhost:8000/auth/login
|
|
# - Complete OAuth flow with Google
|
|
# - Check: http://localhost:8000/auth/user |