1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
// This file is autogenerated, DO NOT EDIT
// ingest/processors/inference.asciidoc:750
[source, python]
----
resp = client.ingest.put_pipeline(
id="query_helper_pipeline",
processors=[
{
"script": {
"source": "ctx.prompt = 'Please generate an elasticsearch search query on index `articles_index` for the following natural language query. Dates are in the field `@timestamp`, document types are in the field `type` (options are `news`, `publication`), categories in the field `category` and can be multiple (options are `medicine`, `pharmaceuticals`, `technology`), and document names are in the field `title` which should use a fuzzy match. Ignore fields which cannot be determined from the natural language query context: ' + ctx.content"
}
},
{
"inference": {
"model_id": "openai_chat_completions",
"input_output": {
"input_field": "prompt",
"output_field": "query"
}
}
},
{
"remove": {
"field": "prompt"
}
}
],
)
print(resp)
----
|