LLM#
- class scikitplot.corpus.LLM(provider, model, *, client, max_tokens, options, cache, clock)[source]#
A language model behind one call shape; made by
make_llm.- Attributes:
- providerstr
"openai","anthropic","gemini"or"callable".- modelstr
Model name.
- max_tokensint or None
Output-token limit sent with every request, if any.
- Parameters:
See also
make_llmThe constructor to use.
- cache_key(prompt, system=None)[source]#
Return the cache key of one request (hex SHA-256).
- Parameters:
- promptstr
User prompt.
- systemstr or None, default=None
System instruction.
- Returns:
- str
- Parameters:
- Return type:
Notes
The key covers the provider, model,
max_tokens, every option (unredacted, so two gateways’ headers never share an entry) and the client’sbase_urlwhere the client exposes one (OpenAI and Anthropic clients do), so two endpoints serving the same model name never share an entry. Only the hash is stored.
- complete(prompt, *, system=None)[source]#
Send one prompt and return the response.
- Parameters:
- promptstr
User prompt.
- systemstr or None, default=None
System instruction.
- Returns:
- Completion
- Raises:
- TypeError
If
promptorsystemis not a string, or a normally ended response holds no text.- IncompleteCompletionError
If the model stopped for any reason but a normal end, whether or not it returned text (the completion keeps its token counts).
- CacheError
If the cache mapping fails.
- Exception
Whatever the provider’s client raises (authentication, rate limit, network); it is not caught here.
- Parameters:
- Return type:
- identity()[source]#
Return what identifies this judge model in a report.
- Returns:
- dict
provider,model,max_tokens(only when set, so the identity holds noNoneand survives every report format) andoptions, with the values ofREDACTED_OPTIONS(extra_headers,extra_query) replaced by"<redacted>". The client, and so its API key, is never included.
- Return type: