Skip to content

Commit

Permalink
Update inquiry schema and copilot component
Browse files Browse the repository at this point in the history
  • Loading branch information
miurla committed Apr 7, 2024
1 parent 261325e commit 1550d6c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion components/copilot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const Copilot: React.FC<CopilotProps> = ({
className={cn('w-4 h-4 flex-shrink-0', { 'animate-spin': pending })}
/>
<p className="text-lg text-foreground text-semibold ml-2">
{data?.inquiry}
{data?.question}
</p>
</div>
<form onSubmit={onFormSubmit}>
Expand Down
2 changes: 1 addition & 1 deletion lib/agents/inquire.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function inquire(
Only ask additional questions if absolutely necessary after receiving an initial response from the user.
Structure your inquiry as follows:
e.g., {
"inquiry": "What specific information are you seeking about Rivian?",
"question": "What specific information are you seeking about Rivian?",
"options": [
{"value": "history", "label": "History"},
{"value": "products", "label": "Products"},
Expand Down
26 changes: 15 additions & 11 deletions lib/schema/inquiry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ import { DeepPartial } from 'ai'
import { z } from 'zod'

export const inquirySchema = z.object({
inquiry: z.string().describe(''),
options: z.array(
z.object({
value: z.string(),
label: z.string()
})
),
names: z.array(z.string()),
allowsInput: z.boolean(),
inputLabel: z.string().optional(),
inputPlaceholder: z.string().optional()
question: z.string().describe('The inquiry question'),
options: z
.array(
z.object({
value: z.string(),
label: z.string()
})
)
.describe('The inquiry options'),
allowsInput: z.boolean().describe('Whether the inquiry allows for input'),
inputLabel: z.string().optional().describe('The label for the input field'),
inputPlaceholder: z
.string()
.optional()
.describe('The placeholder for the input field')
})

export type PartialInquiry = DeepPartial<typeof inquirySchema>

0 comments on commit 1550d6c

Please sign in to comment.