MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / relabelUserTraces

Function relabelUserTraces

web/src/app/api/admin/relabel-for-user/route.ts:152–191  ·  view source on GitHub ↗
(params: {
  userId: string
  limit: number
  promptContext: PromptContext
})

Source from the content-addressed store, hash-verified

150}
151
152async function relabelUserTraces(params: {
153 userId: string
154 limit: number
155 promptContext: PromptContext
156}): Promise<RelabelResult[]> {
157 const { userId, limit, promptContext } = params
158 const allResults: RelabelResult[] = []
159
160 // Run the richer relabeling in parallel
161 const fullContextRelabel = relabelUsingFullFilesForUser({
162 userId,
163 limit,
164 promptContext,
165 })
166
167 for (const model of modelsToRelabel) {
168 logger.info(`Processing traces for model ${model} and user ${userId}...`)
169
170 const traces = await getTracesWithoutRelabels(model, limit, userId)
171 logger.info(
172 `Found ${traces.length} traces without relabels for model ${model}`,
173 )
174
175 const modelResults = await Promise.all(
176 traces.map((trace) =>
177 relabelTraceWithModel({
178 trace,
179 model,
180 promptContext,
181 }),
182 ),
183 )
184
185 allResults.push(...modelResults)
186 }
187
188 await fullContextRelabel
189
190 return allResults
191}
192
193async function relabelTraceWithModel(params: {
194 trace: GetRelevantFilesTrace

Callers 1

POSTFunction · 0.85

Calls 3

getTracesWithoutRelabelsFunction · 0.90
relabelTraceWithModelFunction · 0.85

Tested by

no test coverage detected