File size: 3,443 Bytes
32b70a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/**
 * Generated by orval v8.9.1 🍺
 * Do not edit manually.
 * Api
 * Io HST Search Engine API
 * OpenAPI spec version: 0.1.0
 */
export interface HealthStatus {
  status: string;
}

export interface SearchInput {
  /**
     * @minLength 1
     * @maxLength 500
     */
  query: string;
  /**
     * @minimum 1
     * @maximum 12
     */
  target?: number;
}

export interface SearchResult {
  answer: string;
  sources: string[];
  /** @nullable */
  topUrl?: string | null;
  query: string;
  intent?: string;
  selfReferential?: boolean;
  sourceCount?: number;
  processingMs?: number;
}

export interface ModelInput {
  /**
     * @minLength 1
     * @maxLength 1500
     */
  prompt: string;
  /**
     * @minimum 1
     * @maximum 1024
     */
  maxTokens?: number;
  /**
     * @minimum 0.01
     * @maximum 2
     */
  temperature?: number;
  /**
     * @minimum 1
     * @maximum 200
     */
  topK?: number;
  /**
     * @minimum 0.01
     * @maximum 1
     */
  topP?: number;
  /**
     * @minimum 1
     * @maximum 2
     */
  repetitionPenalty?: number;
  /**
     * @minimum 0
     * @maximum 2
     */
  presencePenalty?: number;
  /**
     * @minimum 1
     * @maximum 8
     */
  nSamples?: number;
}

export interface ModelResult {
  text: string;
  step: number;
  checkpoint?: string;
  coherenceScore?: number;
  bestOfN?: number;
  bestScore?: number;
  /** @nullable */
  error?: string | null;
}

export type FeedbackInputRating = typeof FeedbackInputRating[keyof typeof FeedbackInputRating];


export const FeedbackInputRating = {
  up: 'up',
  down: 'down',
} as const;

export interface FeedbackInput {
  /**
     * @minLength 1
     * @maxLength 500
     */
  query: string;
  rating: FeedbackInputRating;
  sources?: string[];
  /** @maxLength 8000 */
  answer?: string;
}

export interface FeedbackResult {
  ok: boolean;
  ts: number;
}

export type FeedbackStatsSourcesItem = {
  source: string;
  up: number;
  down: number;
  multiplier: number;
};

export interface FeedbackStats {
  totalFeedback: number;
  totalUp: number;
  totalDown: number;
  sources: FeedbackStatsSourcesItem[];
}

export interface FineTuneInput {
  /**
     * @minimum 1
     * @maximum 200
     */
  steps?: number;
  /**
     * @minimum 1e-7
     * @maximum 0.001
     */
  lr?: number;
  /**
     * @minimum 64
     * @maximum 1024
     */
  seqLen?: number;
}

export type FineTuneStateStatus = typeof FineTuneStateStatus[keyof typeof FineTuneStateStatus];


export const FineTuneStateStatus = {
  idle: 'idle',
  running: 'running',
  success: 'success',
  failed: 'failed',
} as const;

export type FineTuneStateGuideStats = { [key: string]: unknown };

export type FineTuneStateLogItem = { [key: string]: unknown };

export interface FineTuneState {
  status: FineTuneStateStatus;
  /** @nullable */
  startedAt?: number | null;
  /** @nullable */
  finishedAt?: number | null;
  steps?: number;
  currentStep?: number;
  /** @nullable */
  loss?: number | null;
  /** @nullable */
  avgLoss?: number | null;
  /** @nullable */
  error?: string | null;
  /** @nullable */
  checkpointOut?: string | null;
  activeCheckpoint?: string;
  fineTunedExists?: boolean;
  guideStats?: FineTuneStateGuideStats;
  log?: FineTuneStateLogItem[];
  ok?: boolean;
}

export interface ModelStatus {
  available: boolean;
  message: string;
  /** @nullable */
  step?: number | null;
  /** @nullable */
  checkpoint?: string | null;
}