Skip to content

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

Description

@satounity

Hello, please excuse the machine translation of this email.

Regarding "return_images=True",
Until last week, the "sonar" model returned image URLs.

However, currently, the "sonar" model does not return image URLs.

The "sonar-pro" model does return image URLs.

Please try the attached code.

from perplexity import Perplexity
import os
os.environ["PERPLEXITY_API_KEY"] = "pplx-XXXXXXXXXXXXXXXXXXXXX"

client = Perplexity()
completion = client.chat.completions.create(
    model="sonar",
    # model="sonar-pro",
    messages=[
        {"role": "user", "content": "What's the weather like in Tokyo today?"}
    ],
    return_images=True,
)


# Answer
# print("===== Answer =====")
# print(completion.choices[0].message.content)

# images
print("===== Images =====")
for img in completion.images:
    print(img)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions