-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
Description
What would you like to see?
AnythingLLM already shows citations when Perplexity is used through its own api #2827 . When accessing Perplexity through OpenRouter the citations are not shown.
I checked that OpenRouter does return these citations:
import os
from openai import OpenAI
def main():
client = OpenAI(
base_url="https://openrouter.ai/api/v1/",
api_key=os.getenv("OPENROUTER_API_KEY"),
)
response = client.chat.completions.create(
model="perplexity/sonar",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "battle of waterloo"},
],
},
],
)
print(response.citations)
if __name__ == "__main__":
main()