Kamil Lewandowski
Kamil Lewandowski
CCConvex Community
Created by Kamil Lewandowski on 8/26/2024 in #support-community
ai API works differently.
yeah, a few request later, answers are changed, so finally the one from convex is fine. Sorry for confusion.
9 replies
CCConvex Community
Created by Kamil Lewandowski on 8/26/2024 in #support-community
ai API works differently.
I was looking for some ai api that has access to the internet and gives up to date info. convex action: try { const response = await fetch("https://api.perplexity.ai/chat/completions", { method: "POST", headers: { "Accept": "application/json", "Content-Type": "application/json", "Authorization": "Bearer " + token, }, body: JSON.stringify({ model: 'llama-3.1-sonar-small-128k-online', messages: [ {role: 'system', content: 'Be precise and concise.'}, {role: 'user', content: reminderDescription} ] }), }); const result = await response.json(); __ curl from postman curl --request POST \ --url https://api.perplexity.ai/chat/completions \ --header 'accept: application/json' \ --header 'authorization: Bearer pplx-...' \ --header 'content-type: application/json' \ --data ' { "model": "llama-3.1-sonar-small-128k-online", "messages": [ { "role": "system", "content": "Be precise and concise." }, { "role": "user", "content": "How many stars are there in our galaxy?" } ] } '
9 replies