Spaces:
Runtime error
Runtime error
add gemini 3
Browse filesFiles changed (5)
57 unmodified lines5859606162639 unmodified lines73747576777821 unmodified lines10010110210310410510 unmodified lines11611711811912012157 unmodified lines1. **Backend**:```bashexport HF_TOKEN="your_huggingface_token"python backend_api.py```9 unmodified lines### Using start script:```bashexport HF_TOKEN="your_token"./start_fullstack.sh```21 unmodified lines## 🤖 Available Models- MiniMax M2 (via HF router with Novita)- DeepSeek V3/V3.1- DeepSeek R110 unmodified lines## 🛠️ Environment Variables- `HF_TOKEN` - HuggingFace API token (required)## 📦 Tech Stack57 unmodified lines585960616263649 unmodified lines7475767778798021 unmodified lines10210310410510610710810 unmodified lines11912012112212312412512612712812957 unmodified lines1. **Backend**:```bashexport HF_TOKEN="your_huggingface_token"export GEMINI_API_KEY="your_gemini_api_key"python backend_api.py```9 unmodified lines### Using start script:```bashexport HF_TOKEN="your_token"export GEMINI_API_KEY="your_gemini_api_key"./start_fullstack.sh```21 unmodified lines## 🤖 Available Models- **Gemini 3 Pro Preview** (Default) - Google's latest with deep thinking & Google Search- MiniMax M2 (via HF router with Novita)- DeepSeek V3/V3.1- DeepSeek R110 unmodified lines## 🛠️ Environment Variables- `HF_TOKEN` - HuggingFace API token (required)- `GEMINI_API_KEY` - Google Gemini API key (required for Gemini 3 Pro Preview)- `POE_API_KEY` - Poe API key (optional, for GPT-5 and Claude models)- `DASHSCOPE_API_KEY` - DashScope API key (optional, for Qwen models)- `OPENROUTER_API_KEY` - OpenRouter API key (optional, for Sherlock models)- `MISTRAL_API_KEY` - Mistral API key (optional, for Mistral models)## 📦 Tech Stack
46 unmodified lines47484950515299 unmodified lines15215315415515615715846 unmodified lines# Available Models ConfigurationAVAILABLE_MODELS = [{"name": "DeepSeek V3.2-Exp","id": "deepseek-ai/DeepSeek-V3.2-Exp",99 unmodified linesk2_model_name_tag = "moonshotai/Kimi-K2-Thinking"# Default model selectionDEFAULT_MODEL_NAME = "Sherlock Dash Alpha"DEFAULT_MODEL = Nonefor _m in AVAILABLE_MODELS:if _m.get("name") == DEFAULT_MODEL_NAME:46 unmodified lines474849505152535455565799 unmodified lines15715815916016116216346 unmodified lines# Available Models ConfigurationAVAILABLE_MODELS = [{"name": "Gemini 3 Pro Preview","id": "gemini-3-pro-preview","description": "Google Gemini 3 Pro Preview with deep thinking, Google Search integration, and advanced reasoning"},{"name": "DeepSeek V3.2-Exp","id": "deepseek-ai/DeepSeek-V3.2-Exp",99 unmodified linesk2_model_name_tag = "moonshotai/Kimi-K2-Thinking"# Default model selectionDEFAULT_MODEL_NAME = "Gemini 3 Pro Preview"DEFAULT_MODEL = Nonefor _m in AVAILABLE_MODELS:if _m.get("name") == DEFAULT_MODEL_NAME:
419 unmodified lines42042142242342442542642751 unmodified lines479480481482483484485419 unmodified linesmessages.append({'role': 'user', 'content': enhanced_query})try:# Handle Mistral API method differenceif _current_model["id"] in ("codestral-2508", "mistral-medium-2508"):completion = client.chat.stream(model=get_real_model_id(_current_model["id"]),messages=messages,51 unmodified linesfor chunk in completion:# Handle different response formats for Mistral vs otherschunk_content = Noneif _current_model["id"] in ("codestral-2508", "mistral-medium-2508"):# Mistral format: chunk.data.choices[0].delta.contentif (hasattr(chunk, "data") and chunk.data and419 unmodified lines42042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046151 unmodified lines513514515516517518519520521522523419 unmodified linesmessages.append({'role': 'user', 'content': enhanced_query})try:# Handle Gemini 3 Pro Preview with native SDKif _current_model["id"] == "gemini-3-pro-preview":# Convert messages to Gemini formatfrom google.genai import typescontents = []for msg in messages:if msg['role'] != 'system': # Gemini doesn't use system role the same waycontents.append(types.Content(role="user" if msg['role'] == 'user' else "model",parts=[types.Part.from_text(text=msg['content'])]))# Add system prompt as first user message if existsif messages and messages[0]['role'] == 'system':system_content = messages[0]['content']contents.insert(0, types.Content(role="user",parts=[types.Part.from_text(text=f"System instructions: {system_content}")]))tools = [types.Tool(googleSearch=types.GoogleSearch())]generate_content_config = types.GenerateContentConfig(thinkingConfig=types.ThinkingConfig(thinkingLevel="HIGH"),tools=tools,max_output_tokens=16384)completion = client.models.generate_content_stream(model="gemini-3-pro-preview",contents=contents,config=generate_content_config,)# Handle Mistral API method differenceelif _current_model["id"] in ("codestral-2508", "mistral-medium-2508"):completion = client.chat.stream(model=get_real_model_id(_current_model["id"]),messages=messages,51 unmodified linesfor chunk in completion:# Handle different response formats for Mistral vs otherschunk_content = Noneif _current_model["id"] == "gemini-3-pro-preview":# Gemini native SDK format: chunk.textif hasattr(chunk, 'text') and chunk.text:chunk_content = chunk.textelif _current_model["id"] in ("codestral-2508", "mistral-medium-2508"):# Mistral format: chunk.data.choices[0].delta.contentif (hasattr(chunk, "data") and chunk.data and
10 unmodified lines1112131415163 unmodified lines2021222324252610 unmodified linesfrom openai import OpenAIfrom mistralai import Mistralimport dashscopefrom .config import HF_TOKEN, AVAILABLE_MODELS3 unmodified linesdef get_inference_client(model_id, provider="auto"):"""Return an InferenceClient with provider based on model_id and user selection."""if model_id == "qwen3-30b-a3b-instruct-2507":# Use DashScope OpenAI clientreturn OpenAI(api_key=os.getenv("DASHSCOPE_API_KEY"),10 unmodified lines11121314151617183 unmodified lines22232425262728293031323310 unmodified linesfrom openai import OpenAIfrom mistralai import Mistralimport dashscopefrom google import genaifrom google.genai import typesfrom .config import HF_TOKEN, AVAILABLE_MODELS3 unmodified linesdef get_inference_client(model_id, provider="auto"):"""Return an InferenceClient with provider based on model_id and user selection."""if model_id == "gemini-3-pro-preview":# Use native Google GenAI client for Gemini 3 Pro Previewreturn genai.Client(api_key=os.getenv("GEMINI_API_KEY"),)elif model_id == "qwen3-30b-a3b-instruct-2507":# Use DashScope OpenAI clientreturn OpenAI(api_key=os.getenv("DASHSCOPE_API_KEY"),
11 unmodified lines1213141511 unmodified lineshtml2textopenaimistralaidashscope11 unmodified lines121314151611 unmodified lineshtml2textopenaimistralaidashscopegoogle-genai
README.md+8
anycoder_app/config.py+6-1
anycoder_app/deploy.py+40-2
anycoder_app/models.py+8-1
requirements.txt+2-1