Skip to content

Commit

Permalink
Inference results is a union of different fields
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkyle committed Nov 15, 2023
1 parent 8d8bf48 commit 89bafd5
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 63 deletions.
8 changes: 7 additions & 1 deletion output/openapi/elasticsearch-serverless-openapi.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

120 changes: 77 additions & 43 deletions output/schema/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 11 additions & 10 deletions output/typescript/types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions specification/inference/_types/Results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,26 @@ import { Dictionary } from '@spec_utils/Dictionary'
* Sparse Embedding tokens are represented as a dictionary
* of string to double.
*/

export type SparseVector = Dictionary<string, float>

/**
* Text Embedding results are represented as Dense Vectors
* of doubles.
* of floats.
*/
export type DenseVector = Array<float>

/**
* Inference result is the union of all the result types
* The text embedding result object
*/
export class TextEmbeddingResult {
embedding: DenseVector
}

/**
* InferenceResult is an aggregation of mutually exclusive variants
* @variants container
*/
export type InferenceResult = SparseVector | DenseVector
export class InferenceResult {
text_embedding?: Array<TextEmbeddingResult>
sparse_vector?: Array<SparseVector>
}
5 changes: 3 additions & 2 deletions specification/inference/_types/Services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import { TaskType } from '../_types/TaskType'
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'

/**
* Configuration options when storing the model config
Expand Down Expand Up @@ -63,6 +64,6 @@ export class ModelConfigContainer {
task_settings: TaskSettings
}

export class ServiceSettings {}
export type ServiceSettings = UserDefinedValue

export class TaskSettings {}
export type TaskSettings = UserDefinedValue
4 changes: 1 addition & 3 deletions specification/inference/inference/InferenceResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@
import { InferenceResult } from '@inference/_types/Results'

export class Response {
body: {
predicted_value: InferenceResult
}
body: InferenceResult
}

0 comments on commit 89bafd5

Please sign in to comment.