langchain_community.llms.cloudflare_workersai.CloudflareWorkersAI¶
class langchain_community.llms.cloudflare_workersai.CloudflareWorkersAI[source]¶
Bases: LLM
Langchain LLM class to help to access Cloudflare Workers AI service.
To use, you must provide an API token and
account ID to access Cloudflare Workers AI, and
pass it as a named parameter to the constructor.
Example
from langchain_community.llms.cloudflare_workersai import CloudflareWorkersAI
my_account_id = "my_account_id"
my_api_token = "my_secret_api_token"
llm_model =  "@cf/meta/llama-2-7b-chat-int8"
cf_ai = CloudflareWorkersAI(
    account_id=my_account_id,
    api_token=my_api_token,
    model=llm_model
)
Initialize the Cloudflare Workers AI class.
param account_id: str [Required]¶
param api_token: str [Required]¶
param base_url: str = 'https://api.cloudflare.com/client/v4/accounts'¶
param cache: Optional[bool] = None¶
param callback_manager: Optional[BaseCallbackManager] = None¶
param callbacks: Callbacks = None¶
param endpoint_url: str = ''¶
param metadata: Optional[Dict[str, Any]] = None¶
Metadata to add to the run trace.
param model: str = '@cf/meta/llama-2-7b-chat-int8'¶
param streaming: bool = False¶
param tags: Optional[List[str]] = None¶
Tags to add to the run trace.
param verbose: bool [Optional]¶
Whether to print out response text.