Skip to content

Commit

Permalink
feat: supported folder_attachments feature in the listing (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
adubovik authored Apr 11, 2024
1 parent 59eb891 commit fad18eb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
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`).<br />`urlAttachmentsSupported`: does the model/application support attachments with URLs (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`).<br />`folderAttachmentsSupported`: does the model/application support folder attachments (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
2 changes: 2 additions & 0 deletions src/main/java/com/epam/aidial/core/config/Features.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ public class Features {
private Boolean systemPromptSupported;
private Boolean toolsSupported;
private Boolean seedSupported;

private Boolean urlAttachmentsSupported;
private Boolean folderAttachmentsSupported;
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,8 @@ private static void setMissingFeatures(Deployment model, Features features) {
if (modelFeatures.getUrlAttachmentsSupported() == null) {
modelFeatures.setUrlAttachmentsSupported(features.getUrlAttachmentsSupported());
}
if (modelFeatures.getFolderAttachmentsSupported() == null) {
modelFeatures.setFolderAttachmentsSupported(features.getFolderAttachmentsSupported());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ static FeaturesData createFeatures(Features features) {
data.setUrlAttachments(features.getUrlAttachmentsSupported());
}

if (features.getFolderAttachmentsSupported() != null) {
data.setFolderAttachments(features.getFolderAttachmentsSupported());
}

return data;
}
}
1 change: 1 addition & 0 deletions src/main/java/com/epam/aidial/core/data/FeaturesData.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ public class FeaturesData {
private boolean tools = false;
private boolean seed = false;
private boolean urlAttachments = false;
private boolean folderAttachments = false;
}
12 changes: 8 additions & 4 deletions src/test/java/com/epam/aidial/core/ListingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ 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, "configuration": false
, "url_attachments": false, "folder_attachments": false
, "configuration": false
}
"""));
}
Expand All @@ -60,7 +61,8 @@ 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, "configuration": false
, "url_attachments": true, "folder_attachments": false
, "configuration": false
}
"""));
}
Expand All @@ -70,7 +72,8 @@ 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, "configuration": true
, "url_attachments": false, "folder_attachments": false
, "configuration": true
}
"""));
}
Expand All @@ -80,7 +83,8 @@ 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, "configuration": false
, "url_attachments": false, "folder_attachments": false
, "configuration": false
}
"""));
}
Expand Down

0 comments on commit fad18eb

Please sign in to comment.