File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -624,6 +624,24 @@ agent = Agent(model)
624
624
...
625
625
```
626
626
627
+ ### Perplexity
628
+
629
+ Follow the Perplexity [ getting started] ( https://docs.perplexity.ai/guides/getting-started )
630
+ guide to create an API key. Then, you can query the Perplexity API with the following:
631
+
632
+ ``` py {title="perplexity_model_init.py"}
633
+ from pydantic_ai import Agent
634
+ from pydantic_ai.models.openai import OpenAIModel
635
+
636
+ model = OpenAIModel(
637
+ ' sonar-pro' ,
638
+ base_url = ' https://api.perplexity.ai' ,
639
+ api_key = ' your-perplexity-api-key' ,
640
+ )
641
+ agent = Agent(model)
642
+ ...
643
+ ```
644
+
627
645
## Implementing Custom Models
628
646
629
647
To implement support for models not already supported, you will need to subclass the [ ` Model ` ] [ pydantic_ai.models.Model ] abstract base class.
You can’t perform that action at this time.
0 commit comments