-
Hello, I'm starting to use the Perplexity API to integrate information query functionalities into an ERP. As I'm just beginning, I suspect I might be doing something wrong. The issue is that a simple question like "Is there any module related to invoicing in Colombia available on Dolistore?" returns a very interesting response from the web UI, mentioning and COMMENTING some modules offered on Dolistore. However, when I use the API, it returns a paragraph that "doesn't say anything useful" like this:
Am I doing something wrong? The endpoints I've tried are Additionally, I'd like to ask how I can obtain the "sources" or "citations" used for the response. I have this variable defined in the API call, but it never returns anything:
By the way, other variables I use:
The system prompt is the typical one for any "chat completion" endpoint. That's not wrong, right? Should I be using a "search prompt" or a special format for system and user messages? I haven't found much relevant information in the API documentation, which is why I'm writing here. Thanks in advance for any help. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 9 replies
-
After writing my initial post, I revisited the API reference regarding this matter and discovered some mistakes I was making. Upon fixing these issues, the results began to more closely resemble those offered by the web UI: Changing the following parameter from 0.5 to 0.9 made the answer seem "a bit more diverse" (it became more proactive in adding things not directly requested, which is fine for me):
However, the real magic happened when I omitted these two parameters I had been sending:
I first removed the search_domain_filter, but the resulting answer to my query barely changed. Then, when I omitted the I hope this helps other people. Please feel free to add any other discoveries you've made in this regard. |
Beta Was this translation helpful? Give feedback.
-
That's very interesting. We ran into the exact same issue and it would be ideal if the API is more in parody with the web app. |
Beta Was this translation helpful? Give feedback.
-
The answers you get in the UI will likely always be better than the answers from the API - it's not only intentional, it's in Perplexity's best interest to do so financially. If their API gave the same results as their UI did, there would be no reason to use their UI as opposed to a competitor wrapping their API in a better interface. Several moderators on their Discord have also officially stated that there is no intention of matching the output quality of the API to their UI. From a technical standpoint, compared to the UI, the API is not only heavily restricted but also lacks the majority of the UI features:
While this is mainly my opinion, I can't be the only one to have noticed the lack of attention the API is getting recently. They originally released the API one year ago in October 2023, and advertised it as a "One-stop shop for open-source LLMs" like Mistral and Llama-2 and "blazing fast inference". All of the open source models have since been removed except for Llama 3.1, and their inference speed doesn't compare to emerging competitors like Groq at this point. They haven't made a blog post for the API since November 2023 which announced their first Online LLM, and even the API wiki's changelog has been radio silent since July 2024, where even then they just announced updated fine-tuned models. I really like their API, it’s just clear at this point their priority is the UI and if you want a similar experience to that via API, you probably need to look elsewhere. |
Beta Was this translation helpful? Give feedback.
-
The answers you get from the API should closely resemble the default search answers in the UI. The API uses the same search subsystem as the UI with small differences in configuration. However, you could be seeing differences between the API and UI due to the following reasons: Pro Search The API doesn't support Pro Search today. Pro Search uses a multi-step reasoning process which increases the quality of the answer. Using third party models At this time, the API only supports the Sonar models. Using other third party models like GPT-4o/Sonnet 3.5 in the UI could lead to diverging results. Tuning of sampling parameters (presence_penalty, top_p etc) and system prompt in the API Our defaults are tuned to give the best results from the API and match the default search experience in the UI. We give users the power to tune the API to their respective use cases and custom tuning to specific use cases might lead to less generalization of the API/different results vs the UI. We recommend not to explicitly provide sampling parameters in your API requests if you want parity with the default experience in the UI. |
Beta Was this translation helpful? Give feedback.
-
@shubhang98 As of Dec 16th, 2024, Perplexity APIs are still lacking in terms of features and quality compared to UI search, even in free tier. Two features most relevant to me:
Is there a roadmap to bring API services on par with the UI search? Would appreciate a response from perplexity team. Thanks a lot! |
Beta Was this translation helpful? Give feedback.
-
Would also appreciate any update on this. For my use case given the same prompt the UI search is always spot on, while API search is usually far from that. I was hoping the new |
Beta Was this translation helpful? Give feedback.
-
I integrated Sonar & Sonar PRO with one of my software applications yesterday, and I did some testing. I agree with you: the responses haven't improved. It was certainly a great improvement when a few months ago the API started returning the "citations" array. This has already allowed me to give a more professional touch and better user experience to my software integrated with "Perplexity searches." But yesterday, I just did a couple of simple tests with a prompt like this: "make me a comparison of the latest models with reasoning abilities, even if they're experimental or Chinese," and the results returned by the API are quite confusing. In fact, I couldn't say if they're "worse" than those returned by PPLX's official web UI, because truthfully, every time I run the query in either environment, the response varies quite a bit in format and content. What does seem apparent is that in the official UI, the result is more "thoughtful" and the response is more elaborate, in terms of understanding the question and expected answer well. While in the API response, it responds by listing models that aren't reasoning models or even mentioning very old models like GPT-3!? Another very strange thing is that I haven't noticed ANY DIFFERENCE between Sonar and Sonar PRO responses!? Neither in speed, format, nor content. Even stranger: in some prompts, Sonar's response is better than Sonar PRO's?!? I hope someone from PPLX might be reading this and check if there's any problem with that implementation... but I would say it's always the same model responding. Could that be? Regards! Note: anyway, I remain a firm enthusiast of Perplexity's value and the great work their champion team has done so far. I never tire of recommending it and bringing them new fans :-) |
Beta Was this translation helpful? Give feedback.
-
I've noticed similar results. Even with Deepseek now integrated into the sonar-reasoning model, I only get a couple citations on the API whereas I get 10+ on the UI. I've even added into the prompt to specifically give me 10 or more citations and it refuses. Search is a large part of what I want to build, anyone having better luck with Search through the API? |
Beta Was this translation helpful? Give feedback.
-
Same trouble here. It seems even worse with the new Sonar model. It's close to useless at this point. I've also noticed the quality of citations provided with API is so much lower than the UI, also considering API provides text based on 10 citations while UI can go above 40 citations... @shubhang98 Some guidance on how to be closer to the Perplexity experience would be highly appreciated. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
After writing my initial post, I revisited the API reference regarding this matter and discovered some mistakes I was making. Upon fixing these issues, the results began to more closely resemble those offered by the web UI:
Changing the following parameter from 0.5 to 0.9 made the answer seem "a bit more diverse" (it became more proactive in adding things not directly requested, which is fine for me):
However, the real magic happened when I omitted these two parameters I had been sending:
I first removed the search_domain_filter, but the resulting answer to my query barely changed. Then, when I omitte…