Skip to content

Commit

Permalink
✨ feat: Support TogetherAI as new model provider (lobehub#1709)
Browse files Browse the repository at this point in the history
* Support TogetherAI as new model provider

* Setting>LLM>TogetherAI temporary use text only, waiting for new icon for TogetherAI

* Add TOGETHERAI_API_KEY env into Dockerfile and update env docs

* Clean up debug log

* Avoid conflict CI test: model google/gemma-7b-it with openrouter

* Add test case for agent runtime TogetherAI
  • Loading branch information
phsontung authored Mar 29, 2024
1 parent c15986e commit d6921ef
Show file tree
Hide file tree
Showing 91 changed files with 1,199 additions and 36 deletions.
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ OPENAI_API_KEY=sk-xxxxxxxxx

#ZEROONE_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

########################################
######### TogetherAI Service ##########
########################################

#TOGETHERAI_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

########################################
############ Market Service ############
########################################
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,7 @@ ENV OPENROUTER_CUSTOM_MODELS ""
# 01.AI
ENV ZEROONE_API_KEY ""

# TogetherAI
ENV TOGETHERAI_API_KEY ""

CMD ["node", "server.js"]
9 changes: 9 additions & 0 deletions docs/self-hosting/environment-variables/model-provider.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,12 @@ When using the `turn` mode, the API Keys will be retrieved in a round-robin mann
- Description: This is the API key you applied for in the 01.AI service
- Default: -
- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`

## TogetherAI

### `TOGETHERAI_API_KEY`

- Type: Required
- Description: This is the API key you applied for in the TogetherAI service
- Default: -
- Example: `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,13 @@ LobeChat 在部署时提供了丰富的模型服务商相关的环境变量,
- 默认值:-
- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`

## TogetherAI

### `TOGETHERAI_API_KEY`

- 类型:必选
- 描述:这是你在 TogetherAI 服务中申请的 API 密钥
- 默认值:-
- 示例:`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`

[azure-api-verion-url]: https://docs.microsoft.com/zh-cn/azure/developer/javascript/api-reference/es-modules/azure-sdk/ai-translation/translationconfiguration?view=azure-node-latest#api-version
1 change: 1 addition & 0 deletions locales/ar/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"oneapi": "وان آبي آي",
"openai": "أوبن إيه آي",
"openrouter": "OpenRouter",
"togetherai": "TogetherAI",
"perplexity": "Perplexity",
"zeroone": "01.AI الصفر والواحد",
"zhipu": "Zhipu"
Expand Down
6 changes: 6 additions & 0 deletions locales/ar/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"InvalidMoonshotAPIKey": "مفتاح API لـ Moonshot AI غير صحيح أو فارغ، يرجى التحقق من مفتاح API لـ Moonshot وإعادة المحاولة",
"InvalidOllamaArgs": "تكوين Ollama غير صحيح، يرجى التحقق من تكوين Ollama وإعادة المحاولة",
"InvalidOpenRouterAPIKey": "مفتاح OpenRouter API غير صحيح أو فارغ، يرجى التحقق من مفتاح OpenRouter API وإعادة المحاولة",
"InvalidTogetherAIAPIKey": "مفتاح TogetherAI API غير صحيح أو فارغ، يرجى التحقق من مفتاح TogetherAI API وإعادة المحاولة",
"InvalidPerplexityAPIKey": "مفتاح Perplexity API غير صحيح أو فارغ، يرجى التحقق من مفتاح Perplexity API وإعادة المحاولة",
"InvalidZeroOneAPIKey": "مفتاح ZeroOne API غير صحيح أو فارغ، يرجى التحقق من مفتاح ZeroOne API وإعادة المحاولة",
"InvalidZhipuAPIKey": "مفتاح Zhipu API غير صحيح أو فارغ، يرجى التحقق من مفتاح Zhipu API وإعادة المحاولة",
Expand All @@ -60,6 +61,7 @@
"OllamaServiceUnavailable": "خدمة Ollama غير متوفرة، يرجى التحقق مما إذا كانت قد تم تشغيلها بشكل صحيح",
"OpenAIBizError": "حدث خطأ في طلب خدمة OpenAI، يرجى التحقق من المعلومات أدناه وإعادة المحاولة",
"OpenRouterBizError": "خطأ في طلب خدمة OpenRouter AI، يرجى التحقق من المعلومات التالية أو إعادة المحاولة",
"TogetherAIBizError": "خطأ في طلب خدمة TogetherAI AI، يرجى التحقق من المعلومات التالية أو إعادة المحاولة",
"PerplexityBizError": "خطأ في طلب خدمة Perplexity AI، يرجى التحقق من المعلومات التالية أو إعادة المحاولة",
"PluginApiNotFound": "عذرًا، لا يوجد API للإضافة في وصف الإضافة، يرجى التحقق من تطابق طريقة الطلب الخاصة بك مع API الوصف",
"PluginApiParamsError": "عذرًا، فشلت التحقق من صحة معلمات الطلب للإضافة، يرجى التحقق من تطابق المعلمات مع معلومات الوصف",
Expand Down Expand Up @@ -118,6 +120,10 @@
"description": "أدخل مفتاح OpenRouter API الخاص بك للبدء في الجلسة. لن يتم تسجيل مفتاح الخاص بك من قبل التطبيق",
"title": "استخدام مفتاح OpenRouter API المخصص"
},
"TogetherAI": {
"description": "أدخل مفتاح TogetherAI API الخاص بك للبدء في الجلسة. لن يتم تسجيل مفتاح الخاص بك من قبل التطبيق",
"title": "استخدام مفتاح TogetherAI API المخصص"
},
"Perplexity": {
"description": "أدخل مفتاح Perplexity API الخاص بك للبدء في الجلسة. لن يتم تسجيل مفتاح الواجهة البرمجية لتطبيقات الجلسة",
"title": "استخدام مفتاح Perplexity API المخصص"
Expand Down
16 changes: 16 additions & 0 deletions locales/ar/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,22 @@
"title": "مفتاح API"
}
},
"TogetherAI": {
"checker": {
"desc": "اختبار صحة عنوان الوكيل"
},
"customModelName": {
"desc": "إضافة نموذج مخصص، استخدم فاصلة (،) للنماذج المتعددة",
"placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free",
"title": "اسم النموذج المخصص"
},
"title": "TogetherAI",
"token": {
"desc": "أدخل مفتاح API من TogetherAI AI",
"placeholder": "مفتاح API من TogetherAI AI",
"title": "مفتاح API"
}
},
"Perplexity": {
"title": "Perplexity AI",
"token": {
Expand Down
2 changes: 1 addition & 1 deletion locales/bg-BG/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@
"dragDesc": "Плъзни и пусни файлове тук, поддържа се качване на няколко изображения. Задръж Shift, за да изпратиш изображения директно.",
"dragTitle": "Качи изображение"
}
}
}
2 changes: 1 addition & 1 deletion locales/bg-BG/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,4 @@
"password": "Парола"
}
}
}
}
2 changes: 1 addition & 1 deletion locales/bg-BG/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
"allAgents": "Всички агенти",
"recentSubmits": "Последни изпратени"
}
}
}
2 changes: 1 addition & 1 deletion locales/bg-BG/migration.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
"missVersion": "В импортираните данни липсва номер на версия. Моля, проверете файла и опитайте отново.",
"noMigration": "Не е намерено решение за мигриране за текущата версия. Моля, проверете номера на версията и опитайте отново. Ако проблемът продължава, моля, изпратете заявка за обратна връзка."
}
}
}
2 changes: 1 addition & 1 deletion locales/bg-BG/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@
},
"title": "Магазин за плъгини"
}
}
}
2 changes: 1 addition & 1 deletion locales/bg-BG/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,4 +504,4 @@
},
"title": "Инструменти за разширение"
}
}
}
2 changes: 1 addition & 1 deletion locales/bg-BG/tool.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"generating": "Генериране...",
"images": "Изображения:"
}
}
}
2 changes: 1 addition & 1 deletion locales/bg-BG/welcome.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"desc2": "Създайте първия си агент и нека започнем~",
"title": "Отключете свръхсилата на мозъка си"
}
}
}
1 change: 1 addition & 0 deletions locales/de-DE/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"oneapi": "One API",
"openai": "OpenAI",
"openrouter": "OpenRouter",
"togetherai": "TogetherAI",
"perplexity": "Perplexity",
"zeroone": "01-AI",
"zhipu": "Zhipu AI"
Expand Down
6 changes: 6 additions & 0 deletions locales/de-DE/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"InvalidMoonshotAPIKey": "Ungültiger oder leerer Moonshot AI API-Schlüssel. Bitte überprüfen Sie den Moonshot API-Schlüssel und versuchen Sie es erneut.",
"InvalidOllamaArgs": "Ollama-Konfiguration ist ungültig. Bitte überprüfen Sie die Ollama-Konfiguration und versuchen Sie es erneut.",
"InvalidOpenRouterAPIKey": "OpenRouter API-Schlüssel ungültig oder leer. Bitte überprüfen Sie den OpenRouter API-Schlüssel und versuchen Sie es erneut.",
"InvalidTogetherAIAPIKey": "TogetherAI API-Schlüssel ungültig oder leer. Bitte überprüfen Sie den TogetherAI API-Schlüssel und versuchen Sie es erneut.",
"InvalidPerplexityAPIKey": "Perplexity API Key ist ungültig oder leer. Bitte überprüfen Sie den Perplexity API Key und versuchen Sie es erneut.",
"InvalidZeroOneAPIKey": "Ungültiger oder leerer ZeroOne-API-Schlüssel. Bitte überprüfen Sie den ZeroOne-API-Schlüssel und versuchen Sie es erneut.",
"InvalidZhipuAPIKey": "Der Zhipu API-Schlüssel ist ungültig oder leer. Bitte überprüfen Sie den Zhipu API-Schlüssel und versuchen Sie es erneut.",
Expand All @@ -60,6 +61,7 @@
"OllamaServiceUnavailable": "Ollama-Dienst nicht verfügbar. Bitte überprüfen Sie, ob er ordnungsgemäß gestartet wurde.",
"OpenAIBizError": "Fehler bei der OpenAI-Serviceanfrage. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut",
"OpenRouterBizError": "Fehler bei der Anforderung des OpenRouter AI-Dienstes. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.",
"TogetherAIBizError": "Fehler bei der Anforderung des TogetherAI AI-Dienstes. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.",
"PerplexityBizError": "Fehler bei der Anforderung des Perplexity AI-Dienstes. Bitte überprüfen Sie die folgenden Informationen oder versuchen Sie es erneut.",
"PluginApiNotFound": "Entschuldigung, das API des Plugins im Plugin-Manifest existiert nicht. Bitte überprüfen Sie, ob Ihre Anfragemethode mit dem Plugin-Manifest-API übereinstimmt",
"PluginApiParamsError": "Entschuldigung, die Eingabeüberprüfung der Plugin-Anfrage ist fehlgeschlagen. Bitte überprüfen Sie, ob die Eingabe mit den API-Beschreibungsinformationen übereinstimmt",
Expand Down Expand Up @@ -118,6 +120,10 @@
"description": "Geben Sie Ihren OpenRouter API-Schlüssel ein, um die Sitzung zu starten. Die App speichert Ihren API-Schlüssel nicht.",
"title": "Verwenden Sie einen benutzerdefinierten OpenRouter API-Schlüssel"
},
"TogetherAI": {
"description": "Geben Sie Ihren TogetherAI API-Schlüssel ein, um die Sitzung zu starten. Die App speichert Ihren API-Schlüssel nicht.",
"title": "Verwenden Sie einen benutzerdefinierten TogetherAI API-Schlüssel"
},
"Perplexity": {
"description": "Geben Sie Ihren eigenen Perplexity API Key ein, um das Gespräch zu beginnen. Die App speichert Ihren API Key nicht.",
"title": "Verwenden Sie einen benutzerdefinierten Perplexity API Key"
Expand Down
16 changes: 16 additions & 0 deletions locales/de-DE/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,22 @@
"title": "API-Schlüssel"
}
},
"TogetherAI": {
"checker": {
"desc": "Überprüfen Sie, ob die Proxy-Adresse korrekt eingegeben wurde"
},
"customModelName": {
"desc": "Fügen Sie benutzerdefinierte Modelle hinzu. Verwenden Sie zur Angabe mehrerer Modelle ein Komma (,)",
"placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free",
"title": "Benutzerdefinierte Modellnamen"
},
"title": "TogetherAI",
"token": {
"desc": "Geben Sie den API-Schlüssel von TogetherAI AI ein",
"placeholder": "TogetherAI AI API-Schlüssel",
"title": "API-Schlüssel"
}
},
"Perplexity": {
"title": "perplexity",
"token": {
Expand Down
1 change: 1 addition & 0 deletions locales/en-US/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"oneapi": "One API",
"openai": "OpenAI",
"openrouter": "OpenRouter",
"togetherai": "TogetherAI",
"perplexity": "Perplexity",
"zeroone": "01-AI",
"zhipu": "Zhipu AI"
Expand Down
6 changes: 6 additions & 0 deletions locales/en-US/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"InvalidMoonshotAPIKey": "The Moonshot AI API Key is incorrect or empty, please check the Moonshot API Key and try again.",
"InvalidOllamaArgs": "Invalid Ollama configuration, please check Ollama configuration and try again",
"InvalidOpenRouterAPIKey": "Invalid or empty OpenRouter API Key. Please check your OpenRouter API Key and try again.",
"InvalidTogetherAIAPIKey": "Invalid or empty TogetherAI API Key. Please check your TogetherAI API Key and try again.",
"InvalidPerplexityAPIKey": "Perplexity API Key is incorrect or empty. Please check the Perplexity API Key and retry.",
"InvalidZeroOneAPIKey": "01-AI API Key is incorrect or empty. Please check the 01-AI API Key and retry.",
"InvalidZhipuAPIKey": "Zhipu API Key is incorrect or empty. Please check the Zhipu API Key and retry.",
Expand All @@ -60,6 +61,7 @@
"OllamaServiceUnavailable": "Ollama service not detected, please check if it is running properly",
"OpenAIBizError": "Error requesting OpenAI service. Please troubleshoot or retry based on the following information.",
"OpenRouterBizError": "Error requesting OpenRouter AI service. Please troubleshoot or retry based on the following information.",
"TogetherAIBizError": "Error requesting TogetherAI AI service. Please troubleshoot or retry based on the following information.",
"PerplexityBizError": "Error requesting Perplexity AI service. Please troubleshoot or retry based on the following information.",
"PluginApiNotFound": "Sorry, the API does not exist in the plugin's manifest. Please check if your request method matches the plugin manifest API",
"PluginApiParamsError": "Sorry, the input parameter validation for the plugin request failed. Please check if the input parameters match the API description",
Expand Down Expand Up @@ -118,6 +120,10 @@
"description": "Enter your OpenRouter API Key to start the session. The application will not store your API Key.",
"title": "Use Custom OpenRouter API Key"
},
"TogetherAI": {
"description": "Enter your TogetherAI API Key to start the session. The application will not store your API Key.",
"title": "Use Custom TogetherAI API Key"
},
"Perplexity": {
"description": "Enter your Perplexity API Key to start the session. The app will not store your API Key.",
"title": "Use custom Perplexity API Key"
Expand Down
16 changes: 16 additions & 0 deletions locales/en-US/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,22 @@
"title": "API Key"
}
},
"TogetherAI": {
"checker": {
"desc": "Test if the proxy address is filled in correctly"
},
"customModelName": {
"desc": "Add custom model, separate multiple models with comma (,)",
"placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free",
"title": "Custom Model Name"
},
"title": "TogetherAI",
"token": {
"desc": "Enter the API Key from TogetherAI AI",
"placeholder": "TogetherAI AI API Key",
"title": "API Key"
}
},
"Perplexity": {
"title": "Perplexity AI",
"token": {
Expand Down
1 change: 1 addition & 0 deletions locales/es-ES/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"oneapi": "One API",
"openai": "OpenAI",
"openrouter": "OpenRouter",
"togetherai": "TogetherAI",
"perplexity": "Perplexity",
"zeroone": "01.AI ZeroOne",
"zhipu": "Zhipu AI"
Expand Down
6 changes: 6 additions & 0 deletions locales/es-ES/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"InvalidMoonshotAPIKey": "La clave de API de Moonshot AI no es válida o está vacía. Por favor, revise la clave de API de Moonshot e inténtelo de nuevo.",
"InvalidOllamaArgs": "La configuración de Ollama no es válida, por favor revisa la configuración de Ollama e inténtalo de nuevo",
"InvalidOpenRouterAPIKey": "La clave de API de OpenRouter es incorrecta o está vacía. Por favor, revisa la clave de API de OpenRouter e inténtalo de nuevo",
"InvalidTogetherAIAPIKey": "La clave de API de TogetherAI es incorrecta o está vacía. Por favor, revisa la clave de API de TogetherAI e inténtalo de nuevo",
"InvalidPerplexityAPIKey": "La clave de API de Perplexity es inválida o está vacía. Por favor, verifica la clave de API de Perplexity e inténtalo de nuevo",
"InvalidZeroOneAPIKey": "La clave de API de ZeroOneBiz es incorrecta o está vacía. Por favor, revise la clave de API de ZeroOneBiz e inténtelo de nuevo.",
"InvalidZhipuAPIKey": "La clave de API de Zhipu es incorrecta o está vacía, por favor, verifica la clave de API de Zhipu e inténtalo de nuevo",
Expand All @@ -60,6 +61,7 @@
"OllamaServiceUnavailable": "Servicio Ollama no disponible: Ollama no detectado. Por favor, verifica si está iniciado correctamente.",
"OpenAIBizError": "Error al solicitar el servicio OpenAI. Depure o reintente según la siguiente información",
"OpenRouterBizError": "Error al solicitar el servicio de IA de OpenRouter. Por favor, revisa la siguiente información o inténtalo de nuevo",
"TogetherAIBizError": "Error al solicitar el servicio de IA de TogetherAI. Por favor, revisa la siguiente información o inténtalo de nuevo",
"PerplexityBizError": "Error comercial al solicitar el servicio de IA de Perplexity. Por favor, revisa la siguiente información o inténtalo de nuevo",
"PluginApiNotFound": "Lo sentimos, el API especificado no existe en el manifiesto del complemento. Verifique si su método de solicitud coincide con el API del manifiesto del complemento",
"PluginApiParamsError": "Lo sentimos, la validación de los parámetros de entrada de la solicitud del complemento no ha pasado. Verifique si los parámetros de entrada coinciden con la información de descripción del API",
Expand Down Expand Up @@ -118,6 +120,10 @@
"description": "Ingresa tu clave de API de OpenRouter para comenzar la sesión. La aplicación no almacenará tu clave de API",
"title": "Usar una clave de API personalizada de OpenRouter"
},
"TogetherAI": {
"description": "Ingresa tu clave de API de TogetherAI para comenzar la sesión. La aplicación no almacenará tu clave de API",
"title": "Usar una clave de API personalizada de TogetherAI"
},
"Perplexity": {
"description": "Ingresa tu clave de API de Perplexity para comenzar la sesión. La aplicación no guardará tu clave de API",
"title": "Usar tu propia clave de API de Perplexity"
Expand Down
16 changes: 16 additions & 0 deletions locales/es-ES/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,22 @@
"title": "API Key"
}
},
"TogetherAI": {
"checker": {
"desc": "Verifica si la dirección del proxy está correctamente escrita"
},
"customModelName": {
"desc": "Agrega modelos personalizados, separados por comas (,) si son varios",
"placeholder": "mistralai/mistral-7b-instruct:free,openchat/openchat-7b:free",
"title": "Nombre del modelo personalizado"
},
"title": "TogetherAI",
"token": {
"desc": "Ingresa la API Key de TogetherAI AI",
"placeholder": "API Key de TogetherAI AI",
"title": "API Key"
}
},
"Perplexity": {
"title": "Perplexity AI",
"token": {
Expand Down
1 change: 1 addition & 0 deletions locales/fr-FR/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"oneapi": "One API",
"openai": "OpenAI",
"openrouter": "OpenRouter",
"togetherai": "TogetherAI",
"perplexity": "Perplexity",
"zeroone": "01. Intelligence Artificielle ZeroOne",
"zhipu": "Zhipu AI"
Expand Down
Loading

0 comments on commit d6921ef

Please sign in to comment.