mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-06-04 21:01:04 +08:00
feat: add MiniMax as a supported LLM provider
MiniMax provides an OpenAI-compatible API, making integration straightforward. This adds: - MiniMax model wrapper class (OpenAI-compatible) - Model token mappings for MiniMax-M1, M2, and M2.5 models - Provider routing in abstract_graph factory - README update listing MiniMax as a supported provider
This commit is contained in:
parent
09fa945144
commit
6a2f8ecc7b
@ -150,7 +150,7 @@ There are other pipelines that can be used to extract information from multiple
|
||||
|
||||
For each of these graphs there is the multi version. It allows to make calls of the LLM in parallel.
|
||||
|
||||
It is possible to use different LLM through APIs, such as **OpenAI**, **Groq**, **Azure** and **Gemini**, or local models using **Ollama**.
|
||||
It is possible to use different LLM through APIs, such as **OpenAI**, **Groq**, **Azure**, **Gemini**, **MiniMax** and more, or local models using **Ollama**.
|
||||
|
||||
Remember to have [Ollama](https://ollama.com/) installed and download the models using the **ollama pull** command, if you want to use local models.
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ from langchain_core.rate_limiters import InMemoryRateLimiter
|
||||
from pydantic import BaseModel
|
||||
|
||||
from ..helpers import models_tokens
|
||||
from ..models import XAI, CLoD, DeepSeek, Nvidia, OneApi
|
||||
from ..models import XAI, CLoD, DeepSeek, MiniMax, Nvidia, OneApi
|
||||
from ..utils.logging import get_logger, set_verbosity_info, set_verbosity_warning
|
||||
|
||||
logger = get_logger(__name__)
|
||||
@ -171,6 +171,7 @@ class AbstractGraph(ABC):
|
||||
"clod",
|
||||
"togetherai",
|
||||
"xai",
|
||||
"minimax",
|
||||
}
|
||||
|
||||
if "/" in llm_params["model"]:
|
||||
@ -226,6 +227,7 @@ class AbstractGraph(ABC):
|
||||
"togetherai",
|
||||
"clod",
|
||||
"xai",
|
||||
"minimax",
|
||||
}:
|
||||
if llm_params["model_provider"] == "bedrock":
|
||||
llm_params["model_kwargs"] = {
|
||||
@ -243,6 +245,9 @@ class AbstractGraph(ABC):
|
||||
if model_provider == "deepseek":
|
||||
return DeepSeek(**llm_params)
|
||||
|
||||
if model_provider == "minimax":
|
||||
return MiniMax(**llm_params)
|
||||
|
||||
if model_provider == "ernie":
|
||||
from langchain_community.chat_models import ErnieBotChat
|
||||
|
||||
|
||||
@ -377,4 +377,11 @@ models_tokens = {
|
||||
"grok-3-mini": 1000000,
|
||||
"grok-beta": 128000,
|
||||
},
|
||||
"minimax": {
|
||||
"MiniMax-M1": 1000000,
|
||||
"MiniMax-M1-40k": 40000,
|
||||
"MiniMax-M2": 204000,
|
||||
"MiniMax-M2.5": 204000,
|
||||
"MiniMax-M2.5-highspeed": 204000,
|
||||
},
|
||||
}
|
||||
|
||||
@ -4,10 +4,11 @@ This module contains the model definitions used in the ScrapeGraphAI application
|
||||
|
||||
from .clod import CLoD
|
||||
from .deepseek import DeepSeek
|
||||
from .minimax import MiniMax
|
||||
from .nvidia import Nvidia
|
||||
from .oneapi import OneApi
|
||||
from .openai_itt import OpenAIImageToText
|
||||
from .openai_tts import OpenAITextToSpeech
|
||||
from .xai import XAI
|
||||
|
||||
__all__ = ["DeepSeek", "OneApi", "OpenAIImageToText", "OpenAITextToSpeech", "CLoD", "XAI", "Nvidia"]
|
||||
__all__ = ["DeepSeek", "MiniMax", "OneApi", "OpenAIImageToText", "OpenAITextToSpeech", "CLoD", "XAI", "Nvidia"]
|
||||
|
||||
23
scrapegraphai/models/minimax.py
Normal file
23
scrapegraphai/models/minimax.py
Normal file
@ -0,0 +1,23 @@
|
||||
"""
|
||||
MiniMax Module
|
||||
"""
|
||||
|
||||
from langchain_openai import ChatOpenAI
|
||||
|
||||
|
||||
class MiniMax(ChatOpenAI):
|
||||
"""
|
||||
A wrapper for the ChatOpenAI class (MiniMax uses an OpenAI-compatible API) that
|
||||
provides default configuration and could be extended with additional methods
|
||||
if needed.
|
||||
|
||||
Args:
|
||||
llm_config (dict): Configuration parameters for the language model.
|
||||
"""
|
||||
|
||||
def __init__(self, **llm_config):
|
||||
if "api_key" in llm_config:
|
||||
llm_config["openai_api_key"] = llm_config.pop("api_key")
|
||||
llm_config["openai_api_base"] = "https://api.minimax.io/v1"
|
||||
|
||||
super().__init__(**llm_config)
|
||||
Loading…
Reference in New Issue
Block a user