Skip to content

Commit

Permalink
Update route.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
berkingurcan committed Aug 7, 2024
1 parent 09c459b commit 50fef62
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/api/talhasearch/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { NextResponse } from 'next/server'
import { validateApiKey } from '@/lib/utils'
import { demoSearcherTool, demoSearchRunnable } from '@/lib/tools'
import { demoSearchToolRunnable } from '@/lib/tools/demoSearch'
import { ChatCompletionMessageParam } from 'openai/resources/chat/completions'

export const runtime = 'edge'

Expand Down Expand Up @@ -67,14 +68,14 @@ export async function POST(req: Request) {
model = 'gpt-4o-mini'
const openai = new OpenAI(configuration)

const messages = [
{ role: "user", content: message },
const messages: ChatCompletionMessageParam[] = [
{ role: "user", content: message }
];


const response = await openai.chat.completions.create({
model: model,
messages,
messages: messages,
tools: [demoSearchToolRunnable.function],
tool_choice: {"type": "function", "function": {"name": demoSearchToolRunnable.function.name}},
});
Expand Down

0 comments on commit 50fef62

Please sign in to comment.