Skip to content

Commit

Permalink
Merge branch 'development' into issue-239
Browse files Browse the repository at this point in the history
  • Loading branch information
astsiapanay authored Feb 29, 2024
2 parents 275a266 + ef128cf commit 25e4f28
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 29 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,12 @@ updates:
commit-message:
# Prefix all commit messages with "chore: "
prefix: "chore"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "wednesday"
time: "09:00"
commit-message:
# Prefix all commit messages with "chore: "
prefix: "chore"
2 changes: 1 addition & 1 deletion .github/workflows/deploy_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
gitlab-dev-deploy:
if: ${{ github.event.registry_package.package_version.container_metadata.tag.name == 'development' }}
uses: epam/ai-dial-ci/.github/workflows/deploy-development.yml@1.3.1
uses: epam/ai-dial-ci/.github/workflows/deploy-development.yml@1.6.0
with:
gitlab-project-id: "1826"
gitlab-project-ref: "master"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-title-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ on:

jobs:
pr-title-check:
uses: epam/ai-dial-ci/.github/workflows/pr-title-check.yml@1.3.1
uses: epam/ai-dial-ci/.github/workflows/pr-title-check.yml@1.6.0
secrets:
ACTIONS_BOT_TOKEN: ${{ secrets.ACTIONS_BOT_TOKEN }}
10 changes: 10 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: PR Workflow

on:
pull_request:
branches: [development, release-*]

jobs:
run_tests:
uses: epam/ai-dial-ci/.github/workflows/java_pr.yml@1.6.0
secrets: inherit
16 changes: 0 additions & 16 deletions .github/workflows/pr_check_tests.yml

This file was deleted.

7 changes: 2 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
name: Release version
name: Release Workflow

on:
push:
branches: [development, release-*]

env:
IMAGE_NAME: ${{ github.repository }}

jobs:
release:
uses: epam/ai-dial-ci/.github/workflows/publish_gradle_docker.yml@1.3.1
uses: epam/ai-dial-ci/.github/workflows/java_release.yml@1.6.0
secrets: inherit
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ Dynamic settings include:
| applications | A list of deployed AI DIAL Applications and their parameters:<br />`<application_name>`: Unique application name. |
| applications.<application_name> | `endpoint`: AI DIAL Application API for chat completions.<br />`iconUrl`: Icon path for the AI DIAL Application on UI.<br />`description`: Brief AI DIAL Application description.<br />`displayName`: AI DIAL Application name on UI.<br />`inputAttachmentTypes`: A list of allowed MIME types for the input attachments.<br />`maxInputAttachments`: Maximum number of input attachments (default is zero when `inputAttachmentTypes` is unset, otherwise, infinity) |
| models | A list of deployed models and their parameters:<br />`<model_name>`: Unique model name. |
| 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 />`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> | `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 only `token` is 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>.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>.upstreams | `endpoint`: Model endpoint.<br />`key`: Your API key. |
| keys | API Keys parameters:<br />`<core_key>`: Your API key. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void handleRequestBody(Buffer requestBody) {
ObjectNode tree = (ObjectNode) ProxyUtil.MAPPER.readTree(stream);

try {
ProxyUtil.collectAttachedFiles(tree, link -> processAttachedFile(link, context.getProxyApiKeyData()));
ProxyUtil.collectAttachedFiles(tree, this::processAttachedFile);
} catch (HttpException e) {
respond(e.getStatus(), e.getMessage());
log.warn("Can't collect attached files. Trace: {}. Span: {}. Error: {}",
Expand Down Expand Up @@ -249,14 +249,19 @@ void handleRequestBody(Buffer requestBody) {
sendRequest();
}

private void processAttachedFile(String url, ApiKeyData apiKeyData) {
private void processAttachedFile(String url) {
ResourceDescription resource = getResourceDescription(url);
if (resource == null) {
return;
}
String resourceUrl = resource.getUrl();
ApiKeyData sourceApiKeyData = context.getApiKeyData();
ApiKeyData destApiKeyData = context.getProxyApiKeyData();
AccessService accessService = proxy.getAccessService();
if (accessService.hasWriteAccess(resource, context) || accessService.isSharedResource(resource, context)) {
apiKeyData.getAttachedFiles().add(resource.getUrl());
if (accessService.hasWriteAccess(resource, context)
|| accessService.isSharedResource(resource, context)
|| sourceApiKeyData.getAttachedFiles().contains(resourceUrl)) {
destApiKeyData.getAttachedFiles().add(resourceUrl);
} else {
throw new HttpException(HttpStatus.FORBIDDEN, "Access denied to the file %s".formatted(url));
}
Expand Down

0 comments on commit 25e4f28

Please sign in to comment.