Skip to content

feat(providers): add Perplexity as a supported model provider#8920

Open
jliounis wants to merge 1 commit intoaaif-goose:mainfrom
jliounis:feat/perplexity-provider
Open

feat(providers): add Perplexity as a supported model provider#8920
jliounis wants to merge 1 commit intoaaif-goose:mainfrom
jliounis:feat/perplexity-provider

Conversation

@jliounis
Copy link
Copy Markdown

Summary

Adds Perplexity as a supported model provider in crates/goose/src/providers/, mirroring the layout of the existing xAI provider (xai.rs).

Perplexity's chat completions API is OpenAI-compatible (https://api.perplexity.ai), so the provider is a thin ProviderDef that returns an OpenAiCompatibleProvider configured with bearer-token auth. Its chat models ship with built-in real-time web search grounding, which is a natural fit for a developer agent that frequently needs to ground answers in current information.

What's added

  • crates/goose/src/providers/perplexity.rs (new) — PerplexityProvider:
    • Base URL: https://api.perplexity.ai (configurable via PERPLEXITY_HOST)
    • Auth: PERPLEXITY_API_KEY (canonical) → PPLX_API_KEY (alias used by Perplexity's SDKs) → error
    • Default model: sonar-pro. Known models: sonar, sonar-pro, sonar-reasoning, sonar-reasoning-pro (users can override GOOSE_MODEL to point at any other model the API accepts)
    • Setup steps wired up for the onboarding wizard.
  • crates/goose/src/providers/mod.rs — register pub mod perplexity;
  • crates/goose/src/providers/init.rs — register PerplexityProvider in the registry (default-off, matching xAI/Venice)
  • crates/goose/tests/providers.rstest_perplexity_provider smoke test entry following the same ProviderTestConfig::with_llm_provider shape as test_xai_provider
  • documentation/docs/getting-started/providers.md — Perplexity row added to the provider matrix

Tests

5 unit tests in crates/goose/src/providers/perplexity.rs (alongside provider source, matching the convention used by venice.rs):

  1. test_metadata_structure — checks name, display_name, default_model, model_doc_link, and both ConfigKeys (PERPLEXITY_API_KEY required+secret+primary, PERPLEXITY_HOST with default).
  2. test_known_models_non_empty — default model is included in the known list.
  3. test_setup_steps_present — onboarding steps reference PERPLEXITY_API_KEY.
  4. test_default_model_is_known.
  5. test_doc_url_points_to_perplexity_docs.

Plus 1 integration test entry (test_perplexity_provider) in crates/goose/tests/providers.rs, which the existing test harness skips when PERPLEXITY_API_KEY isn't set (same pattern as every other LLM provider here).

Validation

cargo test -p goose providers::perplexity
cargo clippy --all-targets -- -D warnings
cargo fmt --check

References

Adds Perplexity as an OpenAI-compatible chat completions provider, modeled
on the xAI provider. Perplexity's chat models are natively grounded in
real-time web search, which is a natural fit for a developer agent.

- crates/goose/src/providers/perplexity.rs (new): PerplexityProvider
  using OpenAiCompatibleProvider with base URL https://api.perplexity.ai.
  Accepts PERPLEXITY_API_KEY (canonical) or PPLX_API_KEY (alias).
- crates/goose/src/providers/{init,mod}.rs: register provider.
- crates/goose/tests/providers.rs: integration smoke test entry.
- documentation/docs/getting-started/providers.md: provider table row.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ad7f68986

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

PERPLEXITY_KNOWN_MODELS.to_vec(),
PERPLEXITY_DOC_URL,
vec![
ConfigKey::new("PERPLEXITY_API_KEY", true, true, None, true),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mark PPLX_API_KEY as a valid configured credential

from_env explicitly accepts PPLX_API_KEY as a fallback, but metadata declares only PERPLEXITY_API_KEY as the required secret. Configuration status is computed from metadata via default_inventory_configured (crates/goose/src/providers/inventory/mod.rs), and exposed through provider_config_status (crates/goose/src/acp/server.rs), so users who set only PPLX_API_KEY will still be reported as unconfigured (and can be filtered out in configured-provider flows) even though runtime auth would succeed. Please add alias-aware configured checks (or include the alias in required-key semantics) so status matches actual provider behavior.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant