feat: publish sanitized custom.97 source
This commit is contained in:
1022 files changed
+69903
-19207
No files matched your search
@@ -34,8 +34,8 @@ func automaticModelMetrics(modelName string) perfmetrics.QueryResult {
|
||||
}
|
||||
|
||||
type automaticCandidate struct {
|
||||
group string
|
||||
cost, ttft, success, ratio float64
|
||||
group string
|
||||
cost, ttft, throughput, success, ratio float64
|
||||
}
|
||||
|
||||
func resolveAutomaticPool(c *gin.Context, modelName string) []model.TokenGroupEntry {
|
||||
@@ -59,7 +59,7 @@ func resolveAutomaticPool(c *gin.Context, modelName string) []model.TokenGroupEn
|
||||
seen := map[string]bool{}
|
||||
for _, ability := range abilities {
|
||||
group := ability.Group
|
||||
if _, ok := allowed[group]; !ok || seen[group] || !IsUserSelectableGroup(userGroup, group) {
|
||||
if _, ok := allowed[group]; !ok || seen[group] || !IsUserSelectableGroup(userGroup, group) || RequestRoutingPolicy(c).ExcludesGroup(group) {
|
||||
continue
|
||||
}
|
||||
channel, err := model.CacheGetChannel(ability.ChannelId)
|
||||
@@ -92,6 +92,14 @@ func resolveAutomaticPool(c *gin.Context, modelName string) []model.TokenGroupEn
|
||||
}
|
||||
ratio := model.EffectiveGroupRatio(c, userGroup, group).GroupRatio
|
||||
item := automaticCandidate{group: group, ttft: math.Inf(1), success: -1, ratio: ratio}
|
||||
if RequestRoutingPolicy(c).AutoPreference == "throughput" {
|
||||
metric, err := GroupModelPerformance(c.Request.Context(), group, modelName)
|
||||
if err != nil {
|
||||
common.SysError("automatic group performance query failed: " + err.Error())
|
||||
} else if metric.Throughput != nil {
|
||||
item.throughput = metric.Throughput.Value
|
||||
}
|
||||
}
|
||||
if metric, ok := metrics[group]; ok && len(metric.Series) > 0 {
|
||||
item.success = metric.SuccessRate
|
||||
|
||||
@@ -125,6 +133,11 @@ func resolveAutomaticPool(c *gin.Context, modelName string) []model.TokenGroupEn
|
||||
|
||||
func sortAutomaticCandidates(items []automaticCandidate, preference string) {
|
||||
slices.SortFunc(items, func(a, b automaticCandidate) int {
|
||||
if preference == "throughput" {
|
||||
if n := cmp.Compare(b.throughput, a.throughput); n != 0 {
|
||||
return n
|
||||
}
|
||||
}
|
||||
if preference == "speed" {
|
||||
if n := cmp.Compare(a.ttft, b.ttft); n != 0 {
|
||||
return n
|
||||
@@ -163,7 +176,7 @@ func AutomaticPoolModels(c *gin.Context) []string {
|
||||
}
|
||||
names := map[string]bool{}
|
||||
for _, ability := range abilities {
|
||||
if !IsUserSelectableGroup(userGroup, ability.Group) {
|
||||
if !IsUserSelectableGroup(userGroup, ability.Group) || RequestRoutingPolicy(c).ExcludesGroup(ability.Group) {
|
||||
continue
|
||||
}
|
||||
channel, err := model.CacheGetChannel(ability.ChannelId)
|
||||
|
||||
Reference in new issue
Block a user