Add support of xAI and their Grok-2 model

Close #1630
This commit is contained in:
Peter Dave Hello
2025-04-08 01:36:21 +08:00
parent a919c62606
commit 665fb90a98
4 changed files with 22 additions and 0 deletions

View File

@ -82,6 +82,9 @@ MAX_TOKENS = {
'groq/llama-3.3-70b-versatile': 128000,
'groq/mixtral-8x7b-32768': 32768,
'groq/gemma2-9b-it': 8192,
'xai/grok-2': 131072,
'xai/grok-2-1212': 131072,
'xai/grok-2-latest': 131072,
'ollama/llama3': 4096,
'watsonx/meta-llama/llama-3-8b-instruct': 4096,
"watsonx/meta-llama/llama-3-70b-instruct": 4096,

View File

@ -67,6 +67,8 @@ class LiteLLMAIHandler(BaseAiHandler):
litellm.api_key = get_settings().groq.key
if get_settings().get("REPLICATE.KEY", None):
litellm.replicate_key = get_settings().replicate.key
if get_settings().get("XAI.KEY", None):
litellm.api_key = get_settings().xai.key
if get_settings().get("HUGGINGFACE.KEY", None):
litellm.huggingface_key = get_settings().huggingface.key
if get_settings().get("HUGGINGFACE.API_BASE", None) and 'huggingface' in get_settings().config.model: