fixes and wip

This commit is contained in:
zaidmukaddam 2024-11-06 00:48:42 +05:30
parent 065bbe7887
commit d7005917ff
4 changed files with 21 additions and 21 deletions

View File

@ -14,7 +14,7 @@ export async function suggestQuestions(history: any[]) {
'use server';
const { object } = await generateObject({
model: groq('llama-3.2-11b-text-preview'),
model: groq('llama-3.2-90b-text-preview'),
temperature: 0,
system:
`You are a search engine query generator. You 'have' to create only '3' questions for the search engine based on the message history which has been provided to you.

View File

@ -12,7 +12,7 @@ import CodeInterpreter from "@e2b/code-interpreter";
import FirecrawlApp from '@mendable/firecrawl-js';
// Allow streaming responses up to 60 seconds
export const maxDuration = 120;
export const maxDuration = 60;
// Azure setup
const azure = createAzure({
@ -54,10 +54,9 @@ export async function POST(req: Request) {
const provider = model.split(":")[0];
const result = await streamText({
maxSteps: 10,
model: registry.languageModel(model),
messages: convertToCoreMessages(messages),
temperature: provider === "azure" ? 0.72 : 0,
messages: messages,
temperature: provider === "azure" ? 0.72 : 0.2,
topP: 0.5,
frequencyPenalty: 0,
presencePenalty: 0,
@ -176,12 +175,6 @@ When asked a "What is" question, maintain the same format as the question and an
.describe(
"A list of domains to specifically exclude from the search results. Default is None, which doesn't exclude any domains.",
),
need_overview: z
.boolean()
.optional()
.describe(
"A boolean value to determine if the overview of the search results is needed. Default is false.",
),
}),
execute: async ({
query,
@ -189,17 +182,21 @@ When asked a "What is" question, maintain the same format as the question and an
topic,
searchDepth,
exclude_domains,
need_overview
}: {
query: string;
maxResults: number;
topic: "general" | "news";
searchDepth: "basic" | "advanced";
exclude_domains?: string[];
need_overview?: boolean;
}) => {
const apiKey = process.env.TAVILY_API_KEY;
const includeImageDescriptions = true
// log all the parameters
console.log("Query:", query);
console.log("Max Results:", maxResults);
console.log("Topic:", topic);
console.log("Search Depth:", searchDepth);
console.log("Exclude Domains:", exclude_domains);
let body = JSON.stringify({
api_key: apiKey,
@ -276,8 +273,7 @@ When asked a "What is" question, maintain the same format as the question and an
return {
results: context,
images: processedImages,
need_overview
images: processedImages
};
},
}),
@ -371,10 +367,14 @@ When asked a "What is" question, maintain the same format as the question and an
description: "Write and execute Python code.",
parameters: z.object({
title: z.string().describe("The title of the code snippet."),
code: z.string().describe("The Python code to execute."),
code: z.string().describe("The Python code to execute. put the variables in the end of the code to print them. do not use the print function."),
icon: z.enum(["stock", "date", "calculation", "default"]).describe("The icon to display for the code snippet."),
}),
execute: async ({ code }: { code: string }) => {
execute: async ({ code, title, icon }: { code: string, title: string, icon: string }) => {
console.log("Code:", code);
console.log("Title:", title);
console.log("Icon:", icon);
const sandbox = await CodeInterpreter.create();
const execution = await sandbox.runCode(code);
let message = "";
@ -440,7 +440,7 @@ When asked a "What is" question, maintain the same format as the question and an
console.log("Error: ", execution.error);
}
console.log(execution.results[0].chart)
console.log(execution.results)
if (execution.results[0].chart) {
execution.results[0].chart.elements.map((element: any) => {
console.log(element.points)

View File

@ -149,7 +149,7 @@ const HomeContent = () => {
const [openChangelog, setOpenChangelog] = useState(false);
const { isLoading, input, messages, setInput, handleInputChange, append, handleSubmit, setMessages, reload, stop } = useChat({
maxToolRoundtrips: selectedModel === 'mistral:pixtral-12b-2409' ? 1 : 2,
maxSteps: 10,
body: {
model: selectedModel,
},
@ -162,7 +162,7 @@ const HomeContent = () => {
}
},
onError: (error) => {
console.error("Chat error:", error);
console.error("Chat error:", error.cause, error.message);
toast.error("An error occurred.", {
description: "We must have ran out of credits. Sponsor us on GitHub to keep this service running.",
action: {

View File

@ -209,7 +209,7 @@ const InteractiveChart: React.FC<ChartProps> = ({
<CardContent>
<ReactECharts
option={options}
style={{ height: '400px', width: '100%' }}
style={{ height: '460px', width: '105%', gap: '20px' }}
/>
</CardContent>
</Card>