Skip to content

Commit

Permalink
Add prefix_string config option for ML models (#2451)
Browse files Browse the repository at this point in the history
* Add prefix_string config option for ML models (#2363)

The prefix_strings option was added to support the E5 model in
elastic/elasticsearch#102089

* Add prefix_strings option to PUT model request (#2449)

Follow up to #2363 where prefix_strings option was added to TrainedModelConfig
  • Loading branch information
davidkyle authored Mar 14, 2024
1 parent d63ae8a commit 2282626
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 20 deletions.
19 changes: 19 additions & 0 deletions output/openapi/elasticsearch-serverless-openapi.json

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

104 changes: 84 additions & 20 deletions output/schema/schema.json

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

7 changes: 7 additions & 0 deletions output/typescript/types.ts

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

12 changes: 12 additions & 0 deletions specification/ml/_types/TrainedModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export class TrainedModelConfig {
metadata?: TrainedModelConfigMetadata
model_size_bytes?: ByteSize
location?: TrainedModelLocation
prefix_strings?: TrainedModelPrefixStrings
}

export class TrainedModelConfigInput {
Expand Down Expand Up @@ -423,3 +424,14 @@ export class TrainedModelLocation {
export class TrainedModelLocationIndex {
name: IndexName
}

export class TrainedModelPrefixStrings {
/**
* String prepended to input at ingest
*/
ingest?: string
/**
* String prepended to input at search
*/
search?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { RequestBase } from '@_types/Base'
import { Id } from '@_types/common'
import { long } from '@_types/Numeric'
import { Definition, Input } from './types'
import { TrainedModelPrefixStrings } from '../_types/TrainedModel'
import { TrainedModelType } from '../_types/TrainedModel'
import { InferenceConfigCreateContainer } from '@ml/_types/inference'

Expand Down Expand Up @@ -102,5 +103,11 @@ export interface Request extends RequestBase {
* An array of tags to organize the model.
*/
tags?: string[]
/**
* Optional prefix strings applied at inference
* @availability stack since=8.12.0
* @availability serverless
*/
prefix_strings?: TrainedModelPrefixStrings
}
}

0 comments on commit 2282626

Please sign in to comment.