feat: publish sanitized custom.97 source
This commit is contained in:
1022 files changed
+69903
-19207
No files matched your search
@@ -139,10 +139,14 @@ func (astraSamplingHandler) Run(parent context.Context, task *model.SystemTask,
|
||||
state.Rounds[index].Reason = reason
|
||||
state.Rounds[index].Usage = usage
|
||||
state.Rounds[index].FinishedAt = time.Now().Unix()
|
||||
if persist() && !payload.Force {
|
||||
if err := model.ApplyDetectionScheduleResult(ctx, id, "modeltrace", state.Rounds[index].ID, state.Rounds[index].FinishedAt, service.FingerprintScheduleOutcome(service.AstraSamplingResultStatus(result))); err != nil {
|
||||
persistErr = err
|
||||
cancel()
|
||||
if persisted := persist(); persisted {
|
||||
service.InvalidateGroupQualityCache()
|
||||
publishGroupStatusChange()
|
||||
if !payload.Force {
|
||||
if err := model.ApplyDetectionScheduleResult(ctx, id, "modeltrace", state.Rounds[index].ID, state.Rounds[index].FinishedAt, service.FingerprintScheduleOutcome(service.AstraSamplingResultStatus(result))); err != nil {
|
||||
persistErr = err
|
||||
cancel()
|
||||
}
|
||||
}
|
||||
}
|
||||
mu.Unlock()
|
||||
@@ -179,6 +183,7 @@ func runModelDetectionProbe(parent context.Context, channel *model.Channel, inde
|
||||
if err != nil {
|
||||
return fingerprint.ProbeResponse{}, index, err
|
||||
}
|
||||
effort := "low"
|
||||
count, output := probe.Count, fingerprint.OutputTokens
|
||||
messages := []map[string]any{{"role": "user", "content": probe.Prompt}}
|
||||
if kind == "benchmark" {
|
||||
@@ -189,14 +194,23 @@ func runModelDetectionProbe(parent context.Context, channel *model.Channel, inde
|
||||
count, output = index, benchmark.OutputTokens
|
||||
messages = []map[string]any{{"role": "system", "content": secondary.System}, {"role": "user", "content": secondary.Prompt}}
|
||||
}
|
||||
if kind == "candy" {
|
||||
count, output = 1, service.CandyOutputTokens
|
||||
messages = []map[string]any{{"role": "user", "content": service.CandyPrompt}}
|
||||
if kind == "vision" {
|
||||
count, output = 1, service.VisionOutputTokens
|
||||
effort = "medium"
|
||||
messages = []map[string]any{{"role": "user", "content": []map[string]any{
|
||||
{"type": "input_text", "text": service.VisionPrompt},
|
||||
{"type": "input_image", "image_url": service.VisionImageURL, "detail": "high"},
|
||||
}}}
|
||||
}
|
||||
if kind == "ciallo" {
|
||||
count, output = 1, service.VisionOutputTokens
|
||||
effort = "medium"
|
||||
messages = []map[string]any{{"role": "user", "content": service.CialloPrompt}}
|
||||
}
|
||||
input, _ := common.Marshal(messages)
|
||||
stream := true
|
||||
limit := uint(output)
|
||||
request := &dto.OpenAIResponsesRequest{Model: fingerprint.Model, Input: input, Stream: &stream, MaxOutputTokens: &limit, Store: []byte("false"), Reasoning: &dto.Reasoning{Effort: "low"}}
|
||||
request := &dto.OpenAIResponsesRequest{Model: fingerprint.Model, Input: input, Stream: &stream, MaxOutputTokens: &limit, Store: []byte("false"), Reasoning: &dto.Reasoning{Effort: effort}}
|
||||
encoded, err := common.Marshal(request)
|
||||
if err != nil {
|
||||
return fingerprint.ProbeResponse{}, count, err
|
||||
@@ -230,6 +244,7 @@ func runModelDetectionProbe(parent context.Context, channel *model.Channel, inde
|
||||
defer boundedCloser.Close()
|
||||
body = bounded
|
||||
}
|
||||
started := time.Now()
|
||||
response, err := adaptor.DoRequest(c, info, body)
|
||||
if err != nil {
|
||||
return fingerprint.ProbeResponse{}, count, errors.New("probe transport failed")
|
||||
@@ -239,12 +254,19 @@ func runModelDetectionProbe(parent context.Context, channel *model.Channel, inde
|
||||
return fingerprint.ProbeResponse{}, count, errors.New("unsupported probe transport")
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
stopClose := context.AfterFunc(ctx, func() { _ = resp.Body.Close() })
|
||||
defer stopClose()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return fingerprint.ProbeResponse{}, count, errors.New("probe HTTP failure")
|
||||
}
|
||||
// Deliberately bypass DoResponse: this is a platform-funded probe, with no
|
||||
// customer token, wallet charge, session binding or generated response relay.
|
||||
answer, err := fingerprint.ReadResponse(resp.Body, resp.Header.Get("Content-Type"))
|
||||
var firstTokenMS *int64
|
||||
answer, err := fingerprint.ReadResponse(resp.Body, resp.Header.Get("Content-Type"), func() {
|
||||
elapsed := time.Since(started).Milliseconds()
|
||||
firstTokenMS = &elapsed
|
||||
})
|
||||
answer.FirstTokenMS = firstTokenMS
|
||||
return answer, count, err
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user