From 52d5196a480643609de6b203691c8b566e273b2a Mon Sep 17 00:00:00 2001 From: dimitrievgs Date: Mon, 13 Jul 2026 00:14:48 +0300 Subject: [PATCH] Change provider to polza.ai --- app/llm_client.py | 141 ++++++++++++----------------------------- app/title_generator.py | 4 +- requirements.txt | 1 + 3 files changed, 45 insertions(+), 101 deletions(-) diff --git a/app/llm_client.py b/app/llm_client.py index c6c8ddd..a293e82 100644 --- a/app/llm_client.py +++ b/app/llm_client.py @@ -28,87 +28,48 @@ MODELS: Dict[str, Dict[str, Any]] = { "stream": True, "capabilities": ["vision"], }, - "gemini-2.5-flash-lite-openrouter": { + "gemini-2.5-flash-lite-polza": { "name": "google/gemini-2.5-flash-lite", "provider": "openai", "model_name": "google/gemini-2.5-flash-lite", - "apiBase": "https://openrouter.ai/api/v1", # Добавлено /api/v1 - "apiKey": - "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", + "apiBase": "https://polza.ai/api/v1", # Добавлено /api/v1 + "apiKey": "pza_qPk0xSBItQkUs18xoBUlyBBeYiHAxasy", "stream": True, "capabilities": ["vision", "reasoning"], "model_kwargs": { "include_reasoning": True } }, - "gemini-2.5-flash-lite-routerai": { - "name": "google/gemini-2.5-flash-lite", - "provider": "openai", - "model_name": "google/gemini-2.5-flash-lite", - "apiBase": "https://routerai.ru/api/v1", # Добавлено /api/v1 - "apiKey": - "sk-QXEteDDGCbAgfyXgSlGFdU7WXc7jCbwB", - "stream": True, - "capabilities": ["vision", "reasoning"], - "model_kwargs": { - "include_reasoning": True - } - }, - "gemini-2.5-flash-r": { - "name": "gemini-2.5-flash-r", - "provider": "openai", # Изменено на "openai" - "model_name": "gemini-2.5-flash", # Добавлено имя модели для LangChain - "apiBase": - "https://render-service-gsu7.onrender.com/g/v1beta", # "generativelanguage.googleapis.com", # "https://render-service-gsu7.onrender.com/g/v1beta", - "apiKey": "AIzaSyDpueKFWVqknVKlQn6TdasLmJ2lvAUiBik", - "stream": True, - "capabilities": ["vision"], - }, - "gemini-2.5-flash-openrouter": { + "gemini-2.5-flash-polza": { "name": "google/gemini-2.5-flash", "provider": "openai", "model_name": "google/gemini-2.5-flash", - "apiBase": "https://openrouter.ai/api/v1", # Добавлено /api/v1 - "apiKey": - "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", + "apiBase": "https://polza.ai/api/v1", # Добавлено /api/v1 + "apiKey": "pza_qPk0xSBItQkUs18xoBUlyBBeYiHAxasy", "stream": True, "capabilities": ["vision", "reasoning"], "model_kwargs": { "include_reasoning": True } }, - "gemini-3.0-flash-openrouter": { + "gemini-3.0-flash-polza": { "name": "google/gemini-3-flash-preview", "provider": "openai", "model_name": "google/gemini-3-flash-preview", - "apiBase": "https://openrouter.ai/api/v1", # Добавлено /api/v1 - "apiKey": - "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", + "apiBase": "https://polza.ai/api/v1", + "apiKey": "pza_qPk0xSBItQkUs18xoBUlyBBeYiHAxasy", "stream": True, "capabilities": ["vision", "reasoning"], "model_kwargs": { "include_reasoning": True } }, - "gemini-3.0-flash-routerai": { - "name": "google/gemini-3-flash-preview", - "provider": "openai", - "model_name": "google/gemini-3-flash-preview", - "apiBase": "https://routerai.ru/api/v1", - "apiKey": "sk-QXEteDDGCbAgfyXgSlGFdU7WXc7jCbwB", - "stream": True, - "capabilities": ["vision", "reasoning"], - "model_kwargs": { - "include_reasoning": True - } - }, - "gemini-3.1-pro-openrouter": { + "gemini-3.1-pro-polza": { "name": "google/gemini-3.1-pro-preview", "provider": "openai", "model_name": "google/gemini-3.1-pro-preview", - "apiBase": "https://openrouter.ai/api/v1", # Добавлено /api/v1 - "apiKey": - "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", + "apiBase": "https://polza.ai/api/v1", + "apiKey": "pza_qPk0xSBItQkUs18xoBUlyBBeYiHAxasy", "stream": True, "capabilities": ["vision", "reasoning"], "model_kwargs": { @@ -136,16 +97,6 @@ MODELS: Dict[str, Dict[str, Any]] = { "stream": True, "capabilities": ["vision"], }, - "mistral-small-latest-r": { - "name": "mistral-small-latest", - "provider": "mistralai", - "model_name": - "mistral-small-latest", # Добавлено имя модели для LangChain - "apiBase": "https://render-service-gsu7.onrender.com/m", - "apiKey": "Q0m29fvxBY0Cfdj4sjHaKqccy1NjonLW", - "stream": True, - "capabilities": ["vision"], - }, "mistral-small-latest-error": { "name": "mistral-small-latest", "provider": "mistralai", @@ -156,64 +107,56 @@ MODELS: Dict[str, Dict[str, Any]] = { "stream": True, "capabilities": ["vision"], }, - "claude-sonnet-4.6-openrouter": { - "name": "anthropic/claude-sonnet-4.6", - "provider": "openai", - "model_name": "anthropic/claude-sonnet-4.6", - "apiBase": "https://openrouter.ai/api/v1", # Добавлено /api/v1 - "apiKey": - "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", - "stream": True, - "capabilities": ["vision", "reasoning"], - "model_kwargs": { - "include_reasoning": True - } - }, - "claude-sonnet-5-routerai": { - "name": "anthropic/claude-sonnet-5", + "claude-sonnet-5-polza": { + "name": "anthropic/claude-sonnet-5", "provider": "openai", "model_name": "anthropic/claude-sonnet-5", - "apiBase": "https://routerai.ru/api/v1", - "apiKey": "sk-QXEteDDGCbAgfyXgSlGFdU7WXc7jCbwB", + "apiBase": "https://polza.ai/api/v1", + "apiKey": "pza_qPk0xSBItQkUs18xoBUlyBBeYiHAxasy", "stream": True, "capabilities": ["vision", "reasoning"], "model_kwargs": { "include_reasoning": True } }, - "deepseek-v4-flash-openrouter": { - "name": "deepseek/deepseek-v4-flash", - "provider": "openai", - "model_name": "deepseek/deepseek-v4-flash", - "apiBase": "https://openrouter.ai/api/v1", # Добавлено /api/v1 - "apiKey": - "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", - "stream": True, - "capabilities": ["vision", "reasoning"], - "model_kwargs": { - "include_reasoning": True - } - }, - "deepseek-v4-flash-routerai": { + "deepseek-v4-flash-polza": { "name": "deepseek/deepseek-chat", "provider": "openai", "model_name": "deepseek/deepseek-chat", - "apiBase": "https://routerai.ru/api/v1", - "apiKey": "sk-QXEteDDGCbAgfyXgSlGFdU7WXc7jCbwB", + "apiBase": "https://polza.ai/api/v1", + "apiKey": "pza_qPk0xSBItQkUs18xoBUlyBBeYiHAxasy", "stream": True, "capabilities": ["vision", "reasoning"], "model_kwargs": { "include_reasoning": True } }, - "deepseek-v3.2-exp-openrouter": { + "deepseek-v3.2-exp-polza": { "name": "deepseek/deepseek-v3.2-exp", "provider": "openrouter", "model_name": "deepseek/deepseek-v3.2-exp", - "apiBase": "https://openrouter.ai/api/v1", - "apiKey": "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", + "apiBase": "https://polza.ai/api/v1", + "apiKey": "pza_qPk0xSBItQkUs18xoBUlyBBeYiHAxasy", "stream": True, "capabilities": ["chat", "reasoning", "code"] + }, + "gigachat-2": { + "name": "GigaChat-2", + "provider": "custom", + "model_name": "GigaChat-2", + "apiBase": "http://localhost:8090/v1", + "apiKey": "my_super_secret_key_123", + "stream": True, + "capabilities": ["chat"] + }, + "gigachat-2-max": { + "name": "GigaChat-2-Max", + "provider": "custom", + "model_name": "GigaChat-2-Max", + "apiBase": "http://localhost:8090/v1", + "apiKey": "my_super_secret_key_123", + "stream": True, + "capabilities": ["chat"] } } @@ -291,7 +234,7 @@ class CustomLLM: kwargs = {"temperature": temperature} if max_tokens: kwargs["max_tokens"] = int(max_tokens) - + response = self.client.chat.completions.create( model=self.model_name, messages=openai_messages, @@ -353,7 +296,7 @@ class CustomLLM: kwargs = {"temperature": temperature} if max_tokens: kwargs["max_tokens"] = int(max_tokens) - + response = self.client.chat.stream(model=self.model_name, messages=mistralai_messages, **kwargs) diff --git a/app/title_generator.py b/app/title_generator.py index cbdb4bc..04122cd 100644 --- a/app/title_generator.py +++ b/app/title_generator.py @@ -11,8 +11,8 @@ from llm_client import DEFAULT_TEMPERATURE, get_llm from langchain_core.messages import SystemMessage, HumanMessage import uuid -DEFAULT_SUMMARIZATION_LLM_NAME = "gemini-2.5-flash-lite-routerai" # "mistral-small-latest" # "mistral-small-latest" #"gemini-2.0-flash-r" -DEFAULT_VOICE_LLM_NAME = "deepseek-v4-flash-routerai" # "gemini-3.0-flash-openrouter" +DEFAULT_SUMMARIZATION_LLM_NAME = "gemini-2.5-flash-lite-polza" # "mistral-small-latest" # "mistral-small-latest" #"gemini-2.0-flash-r" +DEFAULT_VOICE_LLM_NAME = "deepseek-v4-flash-polza" # "gemini-3.0-flash-openrouter" MAX_TITLE_GENERATION_CONTENT_LENGTH = 5000 # Максимальное количество символов для генерации заголовков QUEUE_POLLING_INTERVAL = 4 diff --git a/requirements.txt b/requirements.txt index 5048f9c..ffbe790 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,6 +23,7 @@ numpy==2.1.0 matplotlib==3.8.4 pandas==2.2.2 +symspellpy==6.7.7 # обфускация, сборка