[GH-ISSUE #262] How do I set the variable "user" or "system" for AI inference #176

Open
opened 2026-03-02 11:47:20 +03:00 by kerem · 6 comments
Owner

Originally created by @ghost on GitHub (Jun 30, 2024).
Original GitHub issue: https://github.com/karakeep-app/karakeep/issues/262

Hello,

I use Perplexity to connect Hoarder. But I get the following error message.

2024-06-30T08:42:33.745Z error: [inference][31] inference job failed: Error: 400 Last message must have role user.

it seems that Perplexity, that's how I interpretate it, need the variabele "role" to be set. My question is: how and where can I do that in the config?

Originally created by @ghost on GitHub (Jun 30, 2024). Original GitHub issue: https://github.com/karakeep-app/karakeep/issues/262 Hello, I use Perplexity to connect Hoarder. But I get the following error message. 2024-06-30T08:42:33.745Z error: [inference][31] inference job failed: Error: 400 Last message must have role `user`. it seems that Perplexity, that's how I interpretate it, need the variabele "role" to be set. My question is: how and where can I do that in the config?
Author
Owner

@kamtschatka commented on GitHub (Jun 30, 2024):

Perplexity is not on the supported list, what gives you reason to believe, that this should work?

<!-- gh-comment-id:2198486855 --> @kamtschatka commented on GitHub (Jun 30, 2024): Perplexity is not on the supported list, what gives you reason to believe, that this should work?
Author
Owner

@MohamedBassem commented on GitHub (Jun 30, 2024):

@kamtschatka we support openAI compatible APIs and perplexity is one of them (https://docs.perplexity.ai/docs/getting-started)

<!-- gh-comment-id:2198491924 --> @MohamedBassem commented on GitHub (Jun 30, 2024): @kamtschatka we support openAI compatible APIs and perplexity is one of them (https://docs.perplexity.ai/docs/getting-started)
Author
Owner

@ghost commented on GitHub (Jun 30, 2024):

@kamtschatka I never stated that I believed that Perplexity is supported, although it is an openAI compatible API that is supported by the Hoarder Team, that doesn't mean I should/could work out of the box. Hence the question, nothing more and nothing less 🙏

@MohamedBassem thank you for the clarification, it was the foundation on why I asked this.

<!-- gh-comment-id:2198496452 --> @ghost commented on GitHub (Jun 30, 2024): @kamtschatka I never stated that I believed that Perplexity is supported, although it is an openAI compatible API that is supported by the Hoarder Team, that doesn't mean I should/could work out of the box. Hence the question, nothing more and nothing less 🙏 @MohamedBassem thank you for the clarification, it was the foundation on why I asked this.
Author
Owner

@kamtschatka commented on GitHub (Jun 30, 2024):

@MohamedBassem we should probably update that then and state that we only support OpenAI. It doesn't work for https://github.com/hoarder-app/hoarder/issues/137 and it does not work here.

<!-- gh-comment-id:2198497566 --> @kamtschatka commented on GitHub (Jun 30, 2024): @MohamedBassem we should probably update that then and state that we only support OpenAI. It doesn't work for https://github.com/hoarder-app/hoarder/issues/137 and it does not work here.
Author
Owner

@MohamedBassem commented on GitHub (Jul 1, 2024):

@kamtschatka If it doesn't work for azure and doesn't work for perplexity, it doesn't mean that it doesn't work for other openAI compatible APIs.
I'd argue that the problem here is that perplexity is out of spec (or more restrictive) than openAI.

@Silverdutchman I don't think the problem here is a variable that you have to tune or a role that you have to set. It's probably because we're requesting the inference with the message having the role system here (https://github.com/hoarder-app/hoarder/blob/main/apps/workers/inference.ts#L46) while perplexity wants it to be user instead of system. I think user should work, I'm just a bit concerned if this might degrade the inference performance in any ways.

<!-- gh-comment-id:2199916689 --> @MohamedBassem commented on GitHub (Jul 1, 2024): @kamtschatka If it doesn't work for azure and doesn't work for perplexity, it doesn't mean that it doesn't work for other openAI compatible APIs. I'd argue that the problem here is that perplexity is out of spec (or more restrictive) than openAI. @Silverdutchman I don't think the problem here is a variable that you have to tune or a role that you have to set. It's probably because we're requesting the inference with the message having the role `system` here (https://github.com/hoarder-app/hoarder/blob/main/apps/workers/inference.ts#L46) while perplexity wants it to be `user` instead of system. I think `user` should work, I'm just a bit concerned if this might degrade the inference performance in any ways.
Author
Owner

@MohamedBassem commented on GitHub (Jul 1, 2024):

I'm happy to try to changing the role to user, I don't expect this to cause problems.

<!-- gh-comment-id:2199921220 --> @MohamedBassem commented on GitHub (Jul 1, 2024): I'm happy to try to changing the role to `user`, I don't expect this to cause problems.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/karakeep#176
No description provided.