generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathcontent-evaluator-config.ts
63 lines (60 loc) · 1.84 KB
/
content-evaluator-config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { Static, Type } from "@sinclair/typebox";
import { commentType } from "./formatting-evaluator-config";
const openAiType = Type.Object(
{
/**
* AI model to use for comment evaluation.
*/
model: Type.String({
default: "gpt-4o-2024-08-06",
description: "OpenAI model, e.g. gpt-4o",
examples: ["gpt-4o"],
}),
tokenCountLimit: Type.Integer({
default: 124000,
description:
"Token count limit for a given model. If the content goes beyond the token limit, content will get truncated during evaluation.",
examples: [124000],
}),
/**
* Specific endpoint to send the comments to.
*/
endpoint: Type.String({
default: "https://api.openai.com/v1",
pattern: /^(https?:\/\/[^\s$.?#].\S*)$/i.source,
description: "OpenAI endpoint for requests",
examples: ["https://api.openai.com/v1"],
}),
maxRetries: Type.Number({
default: 10,
description: "Maximum number of retries to make",
examples: ["10"],
}),
},
{ default: {} }
);
export const contentEvaluatorConfigurationType = Type.Object({
openAi: openAiType,
/**
* Multipliers applied to different types of comments
*/
multipliers: Type.Array(
Type.Object({
role: Type.Array(commentType, {
description: "Roles that this multiplier applies to",
examples: ['["PULL_ASSIGNEE", "PULL_AUTHOR", "PULL_COLLABORATOR"]'],
}),
relevance: Type.Optional(Type.Number({ description: "Relevance multiplier for this role", examples: ["2"] })),
}),
{
default: [
{
role: ["ISSUE_SPECIFICATION"],
relevance: 1,
},
],
description: "Multipliers applied to different types of comments",
}
),
});
export type ContentEvaluatorConfiguration = Static<typeof contentEvaluatorConfigurationType>;