langchain.llms.gradient_ai.GradientLLM¶
class langchain.llms.gradient_ai.GradientLLM[source]¶
Bases: LLM
Gradient.ai LLM Endpoints.
GradientLLM is a class to interact with LLMs on gradient.ai
To use, set the environment variable GRADIENT_ACCESS_TOKEN with your
API token and GRADIENT_WORKSPACE_ID for your gradient workspace,
or alternatively provide them as keywords to the constructor of this class.
Example
from langchain.llms.gradientai_endpoint import GradientAIEndpoint
GradientLLM(
    model_id="cad6644_base_ml_model",
    model_kwargs={
        "max_generated_token_count": 200,
        "temperature": 0.75,
        "top_p": 0.95,
        "top_k": 20,
        "stop": [],
    },
    gradient_workspace_id="12345614fc0_workspace",
    gradient_access_token="gradientai-access_token",
)
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param aiosession: Optional[aiohttp.client.ClientSession] = None¶
ClientSession, in case we want to reuse connection for better performance.
param cache: Optional[bool] = None¶
param callback_manager: Optional[BaseCallbackManager] = None¶
param callbacks: Callbacks = None¶
param gradient_access_token: Optional[str] = None¶
gradient.ai API Token, which can be generated by going to
https://auth.gradient.ai/select-workspace
and selecting “Access tokens” under the profile drop-down.
param gradient_api_url: str = 'https://api.gradient.ai/api'¶
Endpoint URL to use.
param gradient_workspace_id: Optional[str] = None¶
Underlying gradient.ai workspace_id.