Skip to content

fix: validate return_images support per model (#61)#64

Open
Abhishek21g wants to merge 1 commit into
perplexityai:mainfrom
Abhishek21g:fix/return-images-capability
Open

fix: validate return_images support per model (#61)#64
Abhishek21g wants to merge 1 commit into
perplexityai:mainfrom
Abhishek21g:fix/return-images-capability

Conversation

@Abhishek21g

Copy link
Copy Markdown

Summary

Fixes #61 — clear client-side behavior when return_images=True is used with models that do not return images.

Problem

return_images=True on sonar no longer returns image URLs while sonar-pro does. The SDK silently sent the parameter without guidance.

Fix

  • perplexity.lib.model_capabilities matrix for known models
  • validate_return_images() raises ReturnImagesUnsupportedError for sonar + return_images=True
  • StreamChunk.images field for typed access to API responses
  • 6 pytest cases with no live API dependency

Verification

python -m venv .venv && .venv/bin/pip install -e . pytest pytest-asyncio pytest-xdist
.venv/bin/pytest tests/test_model_capabilities.py -v

Add model capability matrix, raise clear error for sonar + return_images=True,
and parse images on StreamChunk responses.
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.

This is a bug report regarding the Python library. Regarding "return_images=True"

1 participant