Skip to content

Commit

Permalink
Add hint and displayName in parameters (#1267)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hazel-Datastax authored Jul 15, 2024
1 parent 21fd554 commit 6007782
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
23 changes: 22 additions & 1 deletion src/main/java/io/stargate/sgv2/jsonapi/StargateJsonApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,28 @@
"tokens": []
}
},
"parameters": [],
"parameters": [
{
"name": "organizationId",
"type": "STRING",
"defaultValue": null,
"displayName": "Organization ID",
"help": "Optional, OpenAI Organization ID. If provided passed as `OpenAI-Organization` header.",
"hint": "Add an (optional) organization ID",
"validation": {},
"required": false
},
{
"name": "projectId",
"type": "STRING",
"defaultValue": null,
"displayName": "Project ID",
"help": "Optional, OpenAI Project ID. If provided passed as `OpenAI-Project` header.",
"hint": "Add an (optional) project ID",
"validation": {},
"required": false
}
],
"models": [
{
"name": "text-embedding-3-small",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ interface ParameterConfig {
@Nullable
@JsonProperty
Optional<String> help();

@Nullable
@JsonProperty
Optional<String> displayName();

@Nullable
@JsonProperty
Optional<String> hint();
}

enum ValidationType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ public record ParameterConfigImpl(
boolean required,
Optional<String> defaultValue,
Map<ValidationType, List<Integer>> validation,
Optional<String> help)
Optional<String> help,
Optional<String> displayName,
Optional<String> hint)
implements ParameterConfig {
public ParameterConfigImpl(
EmbeddingGateway.GetSupportedProvidersResponse.ProviderConfig.ParameterConfig
Expand All @@ -65,7 +67,9 @@ public ParameterConfigImpl(
Collectors.toMap(
e -> ValidationType.fromString(e.getKey()),
e -> new ArrayList<>(e.getValue().getValuesList()))),
Optional.of(grpcModelParameter.getHelp()));
Optional.of(grpcModelParameter.getHelp()),
Optional.of(grpcModelParameter.getDisplayName()),
Optional.of(grpcModelParameter.getHint()));
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/proto/embedding_gateway.proto
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ message GetSupportedProvidersResponse {
//No ValidationType Enum, since enum can not be key of map in grpc message
map<string, IntList> validation = 5;
string help = 6;
string display_name = 7;
string hint = 8;

message IntList {
repeated int32 values = 1;
Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/embedding-providers-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ stargate:
type: string
required: false
help: "Optional, OpenAI Organization ID. If provided passed as `OpenAI-Organization` header."
display-name: "Organization ID"
hint: "Add an (optional) organization ID"
- name: projectId
type: string
required: false
help: "Optional, OpenAI Project ID. If provided passed as `OpenAI-Project` header."
display-name: "Project ID"
hint: "Add an (optional) project ID"
properties:
max-batch-size: 2048
models:
Expand Down Expand Up @@ -175,14 +179,20 @@ stargate:
type: string
required: true
help: "The name of your Hugging Face dedicated endpoint, the first part of the Endpoint URL."
display-name: "Endpoint name"
hint: "Add endpoint name"
- name: "regionName"
type: string
required: true
help: "The region your Hugging Face dedicated endpoint is deployed to, the second part of the Endpoint URL."
display-name: "Region name"
hint: "Add region name"
- name: "cloudName"
type: string
required: true
help: "The cloud your Hugging Face dedicated endpoint is deployed to, the third part of the Endpoint URL."
display-name: "Cloud provider where the dedicated endpoint is deployed"
hint: "Add cloud name"
# OUT OF SCOPE FOR INITIAL PREVIEW
vertexai:
# see https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings#get_text_embeddings_for_a_snippet_of_text
Expand Down

0 comments on commit 6007782

Please sign in to comment.