sonar
What it is
A module-level ChatModel instance configured to use Perplexity’s ChatPerplexity chat model with the model id "sonar".
Public API
- Constants
MODEL_ID: str— Model identifier ("sonar").PROVIDER: str— Provider name ("perplexity").
- Objects
model: ChatModel— Preconfigured chat model wrapper:model_id="sonar"provider="perplexity"- underlying
langchain_perplexity.ChatPerplexitywith:temperature=0timeout=120api_keysourced fromABIModule.get_instance().configuration.perplexity_api_key(wrapped inpydantic.SecretStr)
Configuration/Dependencies
- Depends on
langchain_perplexity.ChatPerplexitynaas_abi_marketplace.ai.perplexity.ABIModule(for configuration access)naas_abi_core.models.Model.ChatModelpydantic.SecretStr
- Required configuration
ABIModule.get_instance().configuration.perplexity_api_keymust be set.
Usage
from naas_abi_marketplace.ai.perplexity.models.sonar import model
# Use `model` wherever a `ChatModel` is expected in your application.
# (Exact invocation depends on `ChatModel`'s interface in naas_abi_core.)
print(model.model_id) # "sonar"
print(model.provider) # "perplexity"
Caveats
- Importing this module constructs the
ChatPerplexityclient immediately; it requiresABIModuleto be initialized and haveperplexity_api_keyavailable.