Gary, el Pingüino Artefacto
Gary, el Pingüino Artefacto
CCConvex Community
Created by Gary, el Pingüino Artefacto on 9/10/2024 in #support-community
How to aggregate documents (more than 16K)?
No description
21 replies
CCConvex Community
Created by Gary, el Pingüino Artefacto on 9/8/2024 in #support-community
The filter helper is limited by the 16384 documents scanned?
No description
2 replies
CCConvex Community
Created by Gary, el Pingüino Artefacto on 8/28/2024 in #support-community
Spamming function calls on stream OpenAI responses
Hi, I was looking at the convex-ai-chat repo and found this https://github.com/get-convex/convex-ai-chat/blob/main/convex/serve.ts#L70
const stream = await openai.chat.completions.create({
model: OPENAI_MODEL,
stream: true,
messages: [
{
role: "system",
content:
"Answer the user question based on the provided documents " +
"or report that the question cannot be answered based on " +
"these documents. Keep the answer informative but brief, " +
"do not enumerate all possibilities.",
},
...(relevantDocuments.map(({ text }) => ({
role: "system",
content: "Relevant document:\n\n" + text,
})) as ChatCompletionMessageParam[]),
...(messages.map(({ isViewer, text }) => ({
role: isViewer ? "user" : "assistant",
content: text,
})) as ChatCompletionMessageParam[]),
],
});
let text = "";
for await (const { choices } of stream) {
const replyDelta = choices[0].delta.content;
if (typeof replyDelta === "string" && replyDelta.length > 0) {
text += replyDelta;
await ctx.runMutation(internal.serve.updateBotMessage, {
messageId,
text,
});
}
}
const stream = await openai.chat.completions.create({
model: OPENAI_MODEL,
stream: true,
messages: [
{
role: "system",
content:
"Answer the user question based on the provided documents " +
"or report that the question cannot be answered based on " +
"these documents. Keep the answer informative but brief, " +
"do not enumerate all possibilities.",
},
...(relevantDocuments.map(({ text }) => ({
role: "system",
content: "Relevant document:\n\n" + text,
})) as ChatCompletionMessageParam[]),
...(messages.map(({ isViewer, text }) => ({
role: isViewer ? "user" : "assistant",
content: text,
})) as ChatCompletionMessageParam[]),
],
});
let text = "";
for await (const { choices } of stream) {
const replyDelta = choices[0].delta.content;
if (typeof replyDelta === "string" && replyDelta.length > 0) {
text += replyDelta;
await ctx.runMutation(internal.serve.updateBotMessage, {
messageId,
text,
});
}
}
Isn't a function trigger every time the a new token gets streamed?
2 replies
CCConvex Community
Created by Gary, el Pingüino Artefacto on 3/28/2024 in #support-community
Syncing with Elasticsearch or any search engine
Hi. Is there any guide or blog of how to sync Convex data with Elasticsearch? I have being developing an Ecommerce App to learn Convex and I would like to add some analytics and facet filters. For example: Most sell items on a date range. Orders with more items. Most active users per country. I have being using raw JavaScript with some indexes for the queries, but some of them need "Join-Like". I know there is an Airbyte Connector but I'm not very familiar with Airbyte.
16 replies