Skip to content

Add API for perplexity#1649

Draft
deleSerna wants to merge 6 commits into
embabel:mainfrom
deleSerna:perplexity_support
Draft

Add API for perplexity#1649
deleSerna wants to merge 6 commits into
embabel:mainfrom
deleSerna:perplexity_support

Conversation

@deleSerna
Copy link
Copy Markdown

@johnsonr
Copy link
Copy Markdown
Contributor

johnsonr commented May 2, 2026

Please sign the commit. Thanks

nadeeshtv added 2 commits May 3, 2026 09:32
Signed-off-by: DeleSerna <nadeeshtv@gmail.com>
Signed-off-by: DeleSerna <nadeeshtv@gmail.com>
@deleSerna deleSerna force-pushed the perplexity_support branch from 8aaa846 to 67fccee Compare May 3, 2026 07:33
@deleSerna
Copy link
Copy Markdown
Author

Please sign the commit. Thanks

Done. Thank you

deleSerna added 2 commits May 3, 2026 14:38
Signed-off-by: deleSerna <nadeeshtv@gmail.com>
Signed-off-by: deleSerna <nadeeshtv@gmail.com>
@deleSerna deleSerna marked this pull request as draft May 3, 2026 13:57
@deleSerna
Copy link
Copy Markdown
Author

deleSerna commented May 3, 2026

I have tried to use Perplexity in GOAP example and then realized that SONAR API does not allow tool calling.Will try to use https://api.perplexity.ai/v1/agent . Therefore, I need to update my pull request to include those changes.

@johnsonr johnsonr requested a review from alexheifetz May 6, 2026 23:59
@alexheifetz
Copy link
Copy Markdown
Contributor

@johnsonr the request is still in Draft. @deleSerna please advice when ready for review / merge into main branch.
Tnx

@deleSerna deleSerna marked this pull request as ready for review May 8, 2026 20:20
@deleSerna deleSerna marked this pull request as draft May 8, 2026 20:23
@deleSerna
Copy link
Copy Markdown
Author

@alexheifetz It's almost ready. Doing final round of testing. I should be able to put it in review by tomorrow.

Signed-off-by: deleSerna <nadeeshtv@gmail.com>
@deleSerna deleSerna marked this pull request as ready for review May 8, 2026 21:31
@deleSerna
Copy link
Copy Markdown
Author

@alexheifetz It's finally ready. Please share your feedback

Signed-off-by: deleSerna <nadeeshtv@gmail.com>
@deleSerna deleSerna marked this pull request as draft May 9, 2026 22:17
@deleSerna
Copy link
Copy Markdown
Author

It is running into "g.springframework.ai.retry.NonTransientAiException: 400 - {"error":{"message":"validation failed: input array cannot be empty","type":"invalid_request","code":400}}". I could not immediately spot the mistake. Looking into it. It was perfectly working fine at one point.
Currently I am testing it using a demo app.
is there a better way to test it with in embabel-agent itself?

@alexheifetz
Copy link
Copy Markdown
Contributor

@deleSerna
Copy link
Copy Markdown
Author

@alexheifetz As you can see in my PR, I was trying to leverage existing OpenAIChatModel but IIUC that is not compatible for the v1/Agent API which is what needed to use it with embabel. Therefore, I need to create PerplexityAIChatModel,PerplexityAiApi etc.. from ground up like others. Is that your understanding? I am trying to make sure that I am not in the wrong path before proceeding further.

Therefore that also means my claim It was perfectly working fine at one point. is wrong when it comes with v1/agent api.

@deleSerna
Copy link
Copy Markdown
Author

@johnsonr @alexheifetz I looked into this further and as far as I understood Spring AI only support the chat/completions but not the /v1/responses way. Therefore, I do not think, I could not use Spring AI Open AI model for this and Spring AI has to extend
it's support for Perplexity Agent API path.
I could reproduce the same error,
"g.springframework.ai.retry.NonTransientAiException: 400 - {"error":{"message":"validation failed: input array cannot be empty","type":"invalid_request","code":400}}".
if I follow the same request format used by Spring AI Open AI chat model.

 curl https://api.perplexity.ai/v1/agent  \
  -H "Authorization: Bearer $PERPLEXITY_API_KEY" \
  -H "Content-Type: application/json" \
-d '{
    "model": "perplexity/sonar",           
    "messages": [
      {"role": "system", "content": "Say OK"},
      {"role": "user", "content": "test"}
    ],
    "temperature": 0.6,
    "max_tokens": 100
  }' | jq

I am checking with Perplexity forum about it . But if I understand correctly, unless Spring AI adds a Perplexity Model, it would not work directly.

I am mostly inclined to abandoning my pull request at this point.

Let me know what do you think.

@alexheifetz
Copy link
Copy Markdown
Contributor

@deleSerna Agreed.
Unless there is a way to utilize 3rd party library either from Spring or any other vendors for Perplexity integration, this PR should be moved to the Design Discussion rubric.

@deleSerna
Copy link
Copy Markdown
Author

either from Spring or any other vendors for
I am assuming that OpenAI java sdk may be do that already. Since that will be a deviation from the rest, I am not sure that would be the direction that we want to take.

PR should be moved to the Design Discussion rubric.
@alexheifetz What should I do for that? Just start a thread here or something else?
I would really like to see Perplexity to be integrated here so that I do not need to subscribe to another vendor to experiment with embabel.

@alexheifetz
Copy link
Copy Markdown
Contributor

there is also https://github.com/embabel/embabel-agent-experimental repo. we can create dedicated modules for Perplexity integration. Once ready and works, we will promote to the embabel-agent repo (production repo with Maven Central publishing)

@alexheifetz
Copy link
Copy Markdown
Contributor

alexheifetz commented May 18, 2026

if this works, i can help setting it up.

@deleSerna
Copy link
Copy Markdown
Author

if this works, i can help setting it up.
Yes, that is fine by me.
Would you post here or in some discord channel?
Not directly related but I was wondering how is generally verifying whether this kind of integration works or not so that pull requests would be accepted? Is it like a good samaritan approach here or whether you would have explicitly cross verified this? I am mostly asking to understand the process because unlike in other cases here to verify such a scenario you would need to subscribe to perplexity?

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.

4 participants