Silver-Spy
Silver-Spy
CCConvex Community
Created by Silver-Spy on 9/30/2023 in #show-and-tell
AI Murder Mystery Project [Hackathon]
No description
1 replies
CCConvex Community
Created by Silver-Spy on 9/21/2023 in #support-community
How to add a limit per user for running queries
Hey guys i wanted to add a certain limit per users for queries to run so i dont run out off free credits from Open Ai. How could i achieve such feature with convex?
2 replies
CCConvex Community
Created by Silver-Spy on 9/9/2023 in #support-community
How can i store the output from a function i am running
Hey guys im running LLama using relicate and everything is working and when i console log output i get the result back from the API using actions from convex. I want to now store this data but i cant firgure out how i can store the value in a new table. Here is my function:
// Import necessary modules
import Replicate from 'replicate';
import { action, internalAction, mutation } from './_generated/server';
import { api, internal } from './_generated/api';
import { v } from 'convex/values';

export const runLlama2 = action({
handler: async ({},{prompt,}) => {
// Initialize Replicate with your API token
const replicate = new Replicate({
auth: ,
});

try {
// Run Llama 2 with Replicate
const output = await replicate.run(
'meta/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1',
{
input: {
prompt:prompt,
},
}
);

console.log('Llama 2 output:', output);

return output;

} catch (error) {
console.error('Error running Llama 2:', error);
throw new Error('Failed to run Llama 2');
}
},
});
// Import necessary modules
import Replicate from 'replicate';
import { action, internalAction, mutation } from './_generated/server';
import { api, internal } from './_generated/api';
import { v } from 'convex/values';

export const runLlama2 = action({
handler: async ({},{prompt,}) => {
// Initialize Replicate with your API token
const replicate = new Replicate({
auth: ,
});

try {
// Run Llama 2 with Replicate
const output = await replicate.run(
'meta/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1',
{
input: {
prompt:prompt,
},
}
);

console.log('Llama 2 output:', output);

return output;

} catch (error) {
console.error('Error running Llama 2:', error);
throw new Error('Failed to run Llama 2');
}
},
});
All the mutations and actions are working i just need to store the action result into a table
5 replies
CCConvex Community
Created by Silver-Spy on 9/5/2023 in #support-community
Function undefined is not a supported Convex type.(Next js )
No description
2 replies