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)
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.