Skip to content

Commit

Permalink
feat: Support defaults for chat/completions request parameters in con…
Browse files Browse the repository at this point in the history
…fig #351 (#357)

Co-authored-by: Aliaksandr Stsiapanay <[email protected]>
  • Loading branch information
astsiapanay and astsiapanay authored Jun 7, 2024
1 parent 557ab10 commit b72dead
Show file tree
Hide file tree
Showing 15 changed files with 465 additions and 202 deletions.
3 changes: 3 additions & 0 deletions README.md

Large diffs are not rendered by default.

24 changes: 21 additions & 3 deletions sample/aidial.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@
"folderAttachmentsSupported": false
},
"maxInputAttachments": 10,
"inputAttachmentTypes": ["type1", "type2"]
"inputAttachmentTypes": ["type1", "type2"],
"defaults": {
"paramStr": "value",
"paramBool": true,
"paramInt": 123,
"paramFloat": 0.25
}
}
}
},
Expand All @@ -86,7 +92,13 @@
"folderAttachmentsSupported": false
},
"maxInputAttachments": 10,
"inputAttachmentTypes": ["type1", "type2"]
"inputAttachmentTypes": ["type1", "type2"],
"defaults": {
"paramStr": "value",
"paramBool": true,
"paramInt": 123,
"paramFloat": 0.25
}
}
},
"models": {
Expand Down Expand Up @@ -135,7 +147,13 @@
"folderAttachmentsSupported": false
},
"maxInputAttachments": 10,
"inputAttachmentTypes": ["type1", "type2"]
"inputAttachmentTypes": ["type1", "type2"],
"defaults": {
"paramStr": "value",
"paramBool": true,
"paramInt": 123,
"paramFloat": 0.25
}
},
"embedding-ada": {
"type": "embedding",
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/epam/aidial/core/config/Deployment.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.Data;

import java.util.List;
import java.util.Map;
import java.util.Set;

@Data
Expand All @@ -22,4 +23,8 @@ public abstract class Deployment {
private Features features;
private List<String> inputAttachmentTypes;
private Integer maxInputAttachments;
/**
* Default parameters are applied if a request doesn't contain them in OpenAI chat/completions API call.
*/
private Map<String, Object> defaults = Map.of();
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ private static ApplicationData createApplication(Application application) {
data.setFeatures(DeploymentController.createFeatures(application.getFeatures()));
data.setInputAttachmentTypes(application.getInputAttachmentTypes());
data.setMaxInputAttachments(application.getMaxInputAttachments());
data.setDefaults(application.getDefaults());
return data;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ private static AssistantData createAssistant(Assistant assistant) {
data.setFeatures(DeploymentController.createFeatures(assistant.getFeatures()));
data.setInputAttachmentTypes(assistant.getInputAttachmentTypes());
data.setMaxInputAttachments(assistant.getMaxInputAttachments());
data.setDefaults(assistant.getDefaults());
return data;
}
}
Loading

0 comments on commit b72dead

Please sign in to comment.