mirror of
https://github.com/alibaba/higress.git
synced 2026-02-27 14:10:51 +08:00
feat: enhance model mapper and router with rebuild triggers and path extensions (#3218)
This commit is contained in:
@@ -42,9 +42,10 @@ struct ModelMapperConfigRule {
|
||||
std::vector<std::pair<std::string, std::string>> prefix_model_mapping_;
|
||||
std::string default_model_mapping_;
|
||||
std::vector<std::string> enable_on_path_suffix_ = {
|
||||
"/completions", "/embeddings", "/images/generations",
|
||||
"/audio/speech", "/fine_tuning/jobs", "/moderations",
|
||||
"/image-synthesis", "/video-synthesis"};
|
||||
"/completions", "/embeddings", "/images/generations",
|
||||
"/audio/speech", "/fine_tuning/jobs", "/moderations",
|
||||
"/image-synthesis", "/video-synthesis", "/rerank",
|
||||
"/messages"};
|
||||
};
|
||||
|
||||
// PluginRootContext is the root context for all streams processed by the
|
||||
@@ -60,9 +61,13 @@ class PluginRootContext : public RootContext,
|
||||
FilterHeadersStatus onHeader(const ModelMapperConfigRule&);
|
||||
FilterDataStatus onBody(const ModelMapperConfigRule&, std::string_view);
|
||||
bool configure(size_t);
|
||||
void incrementRequestCount();
|
||||
|
||||
private:
|
||||
bool parsePluginConfig(const json&, ModelMapperConfigRule&) override;
|
||||
uint64_t request_count_ = 0;
|
||||
static constexpr uint64_t REBUILD_THRESHOLD = 1000;
|
||||
static constexpr size_t MEMORY_THRESHOLD_BYTES = 200 * 1024 * 1024;
|
||||
};
|
||||
|
||||
// Per-stream context.
|
||||
|
||||
Reference in New Issue
Block a user