Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: supported url_attachments feature flag for models/applications #261

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Dynamic settings include:
| models.<model_name> | `type`: Model type—`chat` or `embedding`.<br />`iconUrl`: Icon path for the model on UI.<br />`description`: Brief model description.<br />`displayName`: Model name on UI.<br />`displayVersion`: Model version on UI.<br />`endpoint`: Model API for chat completions or embeddings.<br />`tokenizerModel`: Identifies the specific model whose tokenization algorithm exactly matches that of the referenced model. This is typically the name of the earliest-released model in a series of models sharing an identical tokenization algorithm (e.g. `gpt-3.5-turbo-0301`, `gpt-4-0314`, or `gpt-4-1106-vision-preview`). This parameter is essential for DIAL clients that reimplement tokenization algorithms on their side, instead of utilizing the `tokenizeEndpoint` provided by the model.<br />`features`: Model features.<br />`limits`: Model token limits.<br />`pricing`: Model pricing.<br />`upstreams`: Used for load-balancing—request is sent to model endpoint containing X-UPSTREAM-ENDPOINT and X-UPSTREAM-KEY headers. |
| models.<model_name>.limits | `maxPromptTokens`: maximum number of tokens in a completion request.<br />`maxCompletionTokens`: maximum number of tokens in a completion response.<br />`maxTotalTokens`: maximum number of tokens in completion request and response combined.<br />Typically either `maxTotalTokens` is specified or `maxPromptTokens` and `maxCompletionTokens`. |
| models.<model_name>.pricing | `unit`: the pricing units (currently `token` and `char_without_whitespace` are supported).<br />`prompt`: per-unit price for the completion request in USD.<br />`completion`: per-unit price for the completion response in USD. |
| models.<model_name>.features | `rateEndpoint`: endpoint for rate requests *(exposed by core as `<deployment name>/rate`)*.<br />`tokenizeEndpoint`: endpoint for requests to the model tokenizer *(exposed by core as `<deployment name>/tokenize`)*.<br />`truncatePromptEndpoint`: endpoint for truncating prompt requests *(exposed by core as `<deployment name>/truncate_prompt`)*.<br />`systemPromptSupported`: does the model support system prompt (default is `true`).<br />`toolsSupported`: does the model support tools (default is `false`).<br />`seedSupported`: does the model support `seed` request parameter (default is `false`) |
| models.<model_name>.features | `rateEndpoint`: endpoint for rate requests *(exposed by core as `<deployment name>/rate`)*.<br />`tokenizeEndpoint`: endpoint for requests to the model tokenizer *(exposed by core as `<deployment name>/tokenize`)*.<br />`truncatePromptEndpoint`: endpoint for truncating prompt requests *(exposed by core as `<deployment name>/truncate_prompt`)*.<br />`systemPromptSupported`: does the model support system prompt (default is `true`).<br />`toolsSupported`: does the model support tools (default is `false`).<br />`seedSupported`: does the model support `seed` request parameter (default is `false`).<br />`urlAttachmentsSupported`: does the model/application support attachments with URLs (default is `false`) |
| models.<model_name>.upstreams | `endpoint`: Model endpoint.<br />`key`: Your API key. |
| keys | API Keys parameters:<br />`<core_key>`: Your API key. |
| keys.<core_key> | `project`: Project name assigned to this key.<br />`role`: A configured role name that defines key permissions. |
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/epam/aidial/core/config/Features.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ public class Features {
private Boolean systemPromptSupported;
private Boolean toolsSupported;
private Boolean seedSupported;
private Boolean urlAttachmentsSupported;
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,8 @@ private static void setMissingFeatures(Deployment model, Features features) {
if (modelFeatures.getSeedSupported() == null) {
modelFeatures.setSeedSupported(features.getSeedSupported());
}
if (modelFeatures.getUrlAttachmentsSupported() == null) {
modelFeatures.setUrlAttachmentsSupported(features.getUrlAttachmentsSupported());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ static FeaturesData createFeatures(Features features) {
data.setSeed(features.getSeedSupported());
}

if (features.getUrlAttachmentsSupported() != null) {
data.setUrlAttachments(features.getUrlAttachmentsSupported());
}

return data;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ public class FeaturesData {
private boolean systemPrompt = true;
private boolean tools = false;
private boolean seed = false;
private boolean urlAttachments = false;
}
4 changes: 4 additions & 0 deletions src/test/java/com/epam/aidial/core/ListingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ void testFeaturesEmbedding(Vertx vertx, VertxTestContext context) {
checkListing(vertx, context, "/openai/models", "embedding-ada", "features", new JsonObject("""
{ "rate": false, "tokenize": false, "truncate_prompt": false
, "system_prompt": true, "tools": false, "seed": false
, "url_attachments": false
}
"""));
}
Expand All @@ -59,6 +60,7 @@ void testFeaturesModel(Vertx vertx, VertxTestContext context) {
checkListing(vertx, context, "/openai/models", "chat-gpt-35-turbo", "features", new JsonObject("""
{ "rate": true, "tokenize": true, "truncate_prompt": true
, "system_prompt": true, "tools": true, "seed": true
, "url_attachments": true
}
"""));
}
Expand All @@ -68,6 +70,7 @@ void testFeaturesApplication(Vertx vertx, VertxTestContext context) {
checkListing(vertx, context, "/openai/applications", "app", "features", new JsonObject("""
{ "rate": true, "tokenize": false, "truncate_prompt": false
, "system_prompt": false, "tools": false, "seed": false
, "url_attachments": false
}
"""));
}
Expand All @@ -77,6 +80,7 @@ void testFeaturesAssistant(Vertx vertx, VertxTestContext context) {
checkListing(vertx, context, "/openai/assistants", "search-assistant", "features", new JsonObject("""
{ "rate": true, "tokenize": false, "truncate_prompt": false
, "system_prompt": true, "tools": false, "seed": false
, "url_attachments": false
}
"""));
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/aidial.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"tokenizeEndpoint": "http://localhost:7001/upstream/v1/deployments/gpt-35-turbo/tokenizer",
"truncatePromptEndpoint": "http://localhost:7001/upstream/v1/deployments/gpt-35-turbo/trim_history",
"toolsSupported": true,
"seedSupported": true
"seedSupported": true,
"urlAttachmentsSupported": true
}
},
"embedding-ada": {
Expand Down
Loading