Skip to content

Commit afa420d

Browse files
committed
updated
1 parent ec55a1e commit afa420d

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/lib/intelligent-support/schemas.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,12 @@ const KnownAnswerConfidence = z
7676
"A measure of how confidently the AI Assistant completely and directly answered the User Question."
7777
);
7878

79-
const AIAnnotationsToolSchema = z
80-
.object({
81-
answerConfidence: z.union([KnownAnswerConfidence, z.string()]),
82-
})
83-
.passthrough();
79+
const AnswerConfidence = z.union([KnownAnswerConfidence, z.string()]);
80+
const AnswerConfidenceExplanation = z.string().describe("A brief few word justification of why a specific confidence level was chosen.");
8481

85-
export const ProvideAIAnnotationsToolSchema = z.object({
86-
aiAnnotations: AIAnnotationsToolSchema,
82+
export const ProvideAnswerConfidenceToolSchema = z.object({
83+
explanation: AnswerConfidenceExplanation,
84+
answerConfidence: AnswerConfidence,
8785
});
8886

8987
export const ProvideRecordsConsideredToolSchema = z.object({

src/lib/intelligent-support/support.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'server-only';
2-
import { ProvideAIAnnotationsToolSchema, ProvideLinksToolSchema } from './schemas';
2+
import { ProvideAnswerConfidenceToolSchema, ProvideLinksToolSchema } from './schemas';
33

44
import type { CoreMessage } from 'ai';
55
import type { z } from 'zod';
@@ -40,8 +40,8 @@ export const generateQaModeResponse = async ({
4040
provideRecordsConsidered: {
4141
parameters: ProvideRecordsConsideredToolSchema,
4242
},
43-
provideAIAnnotations: {
44-
parameters: ProvideAIAnnotationsToolSchema,
43+
provideAnswerConfidence: {
44+
parameters: ProvideAnswerConfidenceToolSchema,
4545
},
4646
provideLinks: {
4747
parameters: ProvideLinksToolSchema,
@@ -50,16 +50,16 @@ export const generateQaModeResponse = async ({
5050
toolChoice: 'auto',
5151
});
5252

53-
const aiAnnotations = toolCalls.find(toolCall => toolCall.toolName === 'provideAIAnnotations')?.args
54-
.aiAnnotations as z.infer<typeof ProvideAIAnnotationsToolSchema>['aiAnnotations'];
53+
const answerConfidence = toolCalls.find(toolCall => toolCall.toolName === 'provideAnswerConfidence')?.args
54+
.answerConfidence as z.infer<typeof ProvideAnswerConfidenceToolSchema>['answerConfidence'];
5555
const recordsConsidered = toolCalls.find(toolCall => toolCall.toolName === 'provideRecordsConsidered')?.args
5656
.recordsConsidered as z.infer<typeof ProvideRecordsConsideredToolSchema>['recordsConsidered'];
5757
const links = toolCalls.find(toolCall => toolCall.toolName === 'provideLinks')?.args.links as z.infer<
5858
typeof ProvideLinksToolSchema
5959
>['links'];
6060

6161
return {
62-
aiAnnotations,
62+
answerConfidence,
6363
text,
6464
recordsConsidered,
6565
links,

0 commit comments

Comments
 (0)