From 57f7afcea2caacdc4c3e20f29c59c636379bbc3b Mon Sep 17 00:00:00 2001 From: nhtruong <644650+nhtruong@users.noreply.github.com> Date: Thu, 9 Jan 2025 16:32:06 +0000 Subject: [PATCH] Updated opensearch-js to reflect the latest OpenSearch API spec (2025-01-09) Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- api/OpenSearchApi.d.ts | 44 ++++++++++ api/_types/_common.d.ts | 11 +-- ...mmon.d.ts => cat.segment_replication.d.ts} | 19 +---- api/_types/cat.snapshots.d.ts | 2 +- api/_types/ingest._common.d.ts | 43 +--------- api/_types/ml._common.d.ts | 83 ++++++++++++++++++- api/_types/nodes.info.d.ts | 22 +++-- api/cat/allPitSegments.d.ts | 4 +- api/cat/nodes.d.ts | 2 +- api/cat/nodes.js | 2 +- api/cat/pitSegments.d.ts | 4 +- api/cat/segmentReplication.d.ts | 4 +- api/index.d.ts | 20 +++++ api/ml/_api.js | 30 +++++++ api/ml/createMemory.d.ts | 36 ++++++++ api/ml/createMemory.js | 47 +++++++++++ api/ml/createMessage.d.ts | 42 ++++++++++ api/ml/createMessage.js | 50 +++++++++++ api/ml/deleteMemory.d.ts | 31 +++++++ api/ml/deleteMemory.js | 49 +++++++++++ api/ml/getMemory.d.ts | 36 ++++++++ api/ml/getMemory.js | 49 +++++++++++ api/ml/getMessage.d.ts | 31 +++++++ api/ml/getMessage.js | 55 ++++++++++++ api/ml/getMessageTraces.d.ts | 30 +++++++ api/ml/getMessageTraces.js | 49 +++++++++++ api/ml/searchMemory.d.ts | 36 ++++++++ api/ml/searchMemory.js | 47 +++++++++++ api/ml/searchMessage.d.ts | 37 +++++++++ api/ml/searchMessage.js | 50 +++++++++++ api/ml/updateMemory.d.ts | 35 ++++++++ api/ml/updateMemory.js | 50 +++++++++++ api/ml/updateMessage.d.ts | 40 +++++++++ api/ml/updateMessage.js | 50 +++++++++++ 34 files changed, 1057 insertions(+), 83 deletions(-) rename api/_types/{cat._common.d.ts => cat.segment_replication.d.ts} (75%) create mode 100644 api/ml/createMemory.d.ts create mode 100644 api/ml/createMemory.js create mode 100644 api/ml/createMessage.d.ts create mode 100644 api/ml/createMessage.js create mode 100644 api/ml/deleteMemory.d.ts create mode 100644 api/ml/deleteMemory.js create mode 100644 api/ml/getMemory.d.ts create mode 100644 api/ml/getMemory.js create mode 100644 api/ml/getMessage.d.ts create mode 100644 api/ml/getMessage.js create mode 100644 api/ml/getMessageTraces.d.ts create mode 100644 api/ml/getMessageTraces.js create mode 100644 api/ml/searchMemory.d.ts create mode 100644 api/ml/searchMemory.js create mode 100644 api/ml/searchMessage.d.ts create mode 100644 api/ml/searchMessage.js create mode 100644 api/ml/updateMemory.d.ts create mode 100644 api/ml/updateMemory.js create mode 100644 api/ml/updateMessage.d.ts create mode 100644 api/ml/updateMessage.js diff --git a/api/OpenSearchApi.d.ts b/api/OpenSearchApi.d.ts index c0cc99e90..a8dbf3303 100644 --- a/api/OpenSearchApi.d.ts +++ b/api/OpenSearchApi.d.ts @@ -736,6 +736,50 @@ export default class OpenSearchAPI { updateConnector (params: API.Ml_UpdateConnector_Request, callback: callbackFn): TransportRequestCallback; updateConnector (params: API.Ml_UpdateConnector_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; + getMemory (params?: API.Ml_GetMemory_Request, options?: TransportRequestOptions): TransportRequestPromise; + getMemory (callback: callbackFn): TransportRequestCallback; + getMemory (params: API.Ml_GetMemory_Request, callback: callbackFn): TransportRequestCallback; + getMemory (params: API.Ml_GetMemory_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; + + createMemory (params?: API.Ml_CreateMemory_Request, options?: TransportRequestOptions): TransportRequestPromise; + createMemory (callback: callbackFn): TransportRequestCallback; + createMemory (params: API.Ml_CreateMemory_Request, callback: callbackFn): TransportRequestCallback; + createMemory (params: API.Ml_CreateMemory_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; + + searchMemory (params?: API.Ml_SearchMemory_Request, options?: TransportRequestOptions): TransportRequestPromise; + searchMemory (callback: callbackFn): TransportRequestCallback; + searchMemory (params: API.Ml_SearchMemory_Request, callback: callbackFn): TransportRequestCallback; + searchMemory (params: API.Ml_SearchMemory_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; + + deleteMemory (params: API.Ml_DeleteMemory_Request, options?: TransportRequestOptions): TransportRequestPromise; + deleteMemory (params: API.Ml_DeleteMemory_Request, callback: callbackFn): TransportRequestCallback; + deleteMemory (params: API.Ml_DeleteMemory_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; + + updateMemory (params: API.Ml_UpdateMemory_Request, options?: TransportRequestOptions): TransportRequestPromise; + updateMemory (params: API.Ml_UpdateMemory_Request, callback: callbackFn): TransportRequestCallback; + updateMemory (params: API.Ml_UpdateMemory_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; + + searchMessage (params: API.Ml_SearchMessage_Request, options?: TransportRequestOptions): TransportRequestPromise; + searchMessage (params: API.Ml_SearchMessage_Request, callback: callbackFn): TransportRequestCallback; + searchMessage (params: API.Ml_SearchMessage_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; + + getMessage (params?: API.Ml_GetMessage_Request, options?: TransportRequestOptions): TransportRequestPromise; + getMessage (callback: callbackFn): TransportRequestCallback; + getMessage (params: API.Ml_GetMessage_Request, callback: callbackFn): TransportRequestCallback; + getMessage (params: API.Ml_GetMessage_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; + + createMessage (params: API.Ml_CreateMessage_Request, options?: TransportRequestOptions): TransportRequestPromise; + createMessage (params: API.Ml_CreateMessage_Request, callback: callbackFn): TransportRequestCallback; + createMessage (params: API.Ml_CreateMessage_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; + + updateMessage (params: API.Ml_UpdateMessage_Request, options?: TransportRequestOptions): TransportRequestPromise; + updateMessage (params: API.Ml_UpdateMessage_Request, callback: callbackFn): TransportRequestCallback; + updateMessage (params: API.Ml_UpdateMessage_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; + + getMessageTraces (params: API.Ml_GetMessageTraces_Request, options?: TransportRequestOptions): TransportRequestPromise; + getMessageTraces (params: API.Ml_GetMessageTraces_Request, callback: callbackFn): TransportRequestCallback; + getMessageTraces (params: API.Ml_GetMessageTraces_Request, options: TransportRequestOptions, callback: callbackFn): TransportRequestCallback; + registerModelGroup (params?: API.Ml_RegisterModelGroup_Request, options?: TransportRequestOptions): TransportRequestPromise; registerModelGroup (callback: callbackFn): TransportRequestCallback; registerModelGroup (params: API.Ml_RegisterModelGroup_Request, callback: callbackFn): TransportRequestCallback; diff --git a/api/_types/_common.d.ts b/api/_types/_common.d.ts index e235b9d24..76a67ebe7 100644 --- a/api/_types/_common.d.ts +++ b/api/_types/_common.d.ts @@ -78,7 +78,7 @@ export type byte = number export type ByteCount = number -export type ByteUnit = 'b' | 'g' | 'gb' | 'k' | 'kb' | 'm' | 'mb' | 'p' | 'pb' | 't' | 'tb' +export type ByteUnit = 'b' | 'kb' | 'k' | 'mb' | 'm' | 'gb' | 'g' | 'tb' | 't' | 'pb' | 'p' export type ClusterDetails = { _shards?: ShardStatistics; @@ -280,11 +280,6 @@ export type HealthStatus = 'green' | 'GREEN' | 'yellow' | 'YELLOW' | 'red' | 'RE export type Host = string -export type HourAndMinute = { - hour: number[]; - minute: number[]; -} - export type HttpHeaders = Record export type HumanReadableByteCount = string @@ -633,8 +628,6 @@ export type RrfRank = RankBase & { window_size?: number; } -export type ScheduleTimeOfDay = string | HourAndMinute - export type ScoreSort = { order?: SortOrder; } @@ -849,7 +842,7 @@ export type ThreadInfo = { export type TimeOfDay = string -export type TimeUnit = 'd' | 'h' | 'm' | 'micros' | 'ms' | 'nanos' | 's' +export type TimeUnit = 'nanos' | 'micros' | 'ms' | 's' | 'm' | 'h' | 'd' export type TimeZone = string diff --git a/api/_types/cat._common.d.ts b/api/_types/cat.segment_replication.d.ts similarity index 75% rename from api/_types/cat._common.d.ts rename to api/_types/cat.segment_replication.d.ts index b811a75fc..539b383f4 100644 --- a/api/_types/cat._common.d.ts +++ b/api/_types/cat.segment_replication.d.ts @@ -16,24 +16,7 @@ import * as Common from './_common' -export type CatPitSegmentsRecord = { - committed?: string; - compound?: string; - 'docs.count'?: string; - 'docs.deleted'?: string; - generation?: string; - index?: string; - ip?: string; - prirep?: string; - searchable?: string; - segment?: string; - shard?: string; - size?: string; - 'size.memory'?: string; - version?: string; -} - -export type CatSegmentReplicationRecord = { +export type SegmentReplicationRecord = { bytes?: string; bytes_behind?: string; bytes_fetched?: string; diff --git a/api/_types/cat.snapshots.d.ts b/api/_types/cat.snapshots.d.ts index c22093910..5f3b2ae10 100644 --- a/api/_types/cat.snapshots.d.ts +++ b/api/_types/cat.snapshots.d.ts @@ -26,7 +26,7 @@ export type SnapshotsRecord = { reason?: string; repository?: string; start_epoch?: Common.StringifiedEpochTimeUnitSeconds; - start_time?: Common.ScheduleTimeOfDay; + start_time?: Common.TimeOfDay; status?: string; successful_shards?: string; total_shards?: string; diff --git a/api/_types/ingest._common.d.ts b/api/_types/ingest._common.d.ts index 77cc7be8f..ce9e23577 100644 --- a/api/_types/ingest._common.d.ts +++ b/api/_types/ingest._common.d.ts @@ -19,7 +19,7 @@ import * as Common from './_common' export type AppendProcessor = ProcessorBase & { allow_duplicates?: boolean; field: Common.Field; - value: Record[]; + value: any[]; } export type AttachmentProcessor = ProcessorBase & { @@ -97,16 +97,6 @@ export type DotExpanderProcessor = ProcessorBase & { export type DropProcessor = ProcessorBase & Record -export type EnrichProcessor = ProcessorBase & { - field: Common.Field; - ignore_missing?: boolean; - max_matches?: number; - override?: boolean; - policy_name: string; - shape_relation?: Common.GeoShapeRelation; - target_field: Common.Field; -} - export type FailProcessor = ProcessorBase & { message: string; } @@ -142,31 +132,6 @@ export type GsubProcessor = ProcessorBase & { target_field?: Common.Field; } -export type InferenceConfig = { - classification?: InferenceConfigClassification; - regression?: InferenceConfigRegression; -} - -export type InferenceConfigClassification = { - num_top_classes?: number; - num_top_feature_importance_values?: number; - prediction_field_type?: string; - results_field?: Common.Field; - top_classes_results_field?: Common.Field; -} - -export type InferenceConfigRegression = { - num_top_feature_importance_values?: number; - results_field?: Common.Field; -} - -export type InferenceProcessor = ProcessorBase & { - field_map?: Record>; - inference_config?: InferenceConfig; - model_id: Common.Id; - target_field?: Common.Field; -} - export type JoinProcessor = ProcessorBase & { field: Common.Field; separator: string; @@ -236,13 +201,11 @@ export type ProcessorContainer = { dissect?: DissectProcessor; dot_expander?: DotExpanderProcessor; drop?: DropProcessor; - enrich?: EnrichProcessor; fail?: FailProcessor; foreach?: ForeachProcessor; geoip?: GeoIpProcessor; grok?: GrokProcessor; gsub?: GsubProcessor; - inference?: InferenceProcessor; join?: JoinProcessor; json?: JsonProcessor; kv?: KeyValueProcessor; @@ -287,7 +250,7 @@ export type SetSecurityUserProcessor = ProcessorBase & { properties?: string[]; } -export type ShapeType = 'geo_shape' | 'shape' +export type ShapeType = 'geo_shape' | 'xy_shape' export type SortProcessor = ProcessorBase & { field: Common.Field; @@ -304,7 +267,7 @@ export type SplitProcessor = ProcessorBase & { } export type TextEmbeddingProcessor = ProcessorBase & { - description?: string; + batch_size?: number; field_map: Record; model_id: Common.Id; } diff --git a/api/_types/ml._common.d.ts b/api/_types/ml._common.d.ts index 57dfb9f8a..34043afef 100644 --- a/api/_types/ml._common.d.ts +++ b/api/_types/ml._common.d.ts @@ -26,6 +26,8 @@ export type Action = { url?: string; } +export type AdditionalInfo = Record + export type Algorithm = { value?: 'AD_LIBSVM' | 'AGENT' | 'ANOMALY_LOCALIZATION' | 'BATCH_RCF' | 'CONNECTOR' | 'FIT_RCF' | 'KMEANS' | 'LINEAR_REGRESSION' | 'LOCAL_SAMPLE_CALCULATOR' | 'LOGISTIC_REGRESSION' | 'METRICS_CORRELATION' | 'QUESTION_ANSWERING' | 'RCF_SUMMARIZE' | 'REMOTE' | 'SAMPLE_ALGO' | 'SPARSE_ENCODING' | 'SPARSE_TOKENIZE' | 'TEXT_EMBEDDING' | 'TEXT_SIMILARITY'; } @@ -88,6 +90,19 @@ export type GetConnectorResponse = { version?: Common.VersionString; } +export type GetMemoryResponse = Memory | { + memories?: Memory[]; + next_token?: number; +} + +export type GetMessageResponse = Message | { + messages?: Message[]; +} + +export type GetMessageTracesResponse = { + traces?: Message[]; +} + export type Headers = { content_type?: string; [key: string]: any; @@ -122,12 +137,32 @@ export type LLM = { export type Match = { description?: string; + [key: string]: any; } export type MatchAllQuery = Record export type Memory = { + additional_info?: AdditionalInfo; + create_time?: string; + memory_id?: Common.Name; + name?: Common.Name; type?: string; + updated_time?: string; + user?: string; +} + +export type Message = { + additional_info?: AdditionalInfo; + create_time?: string; + input?: undefined | string; + memory_id?: Common.Name; + message_id?: Common.Name; + origin?: undefined | string; + parent_message_id?: undefined | string; + prompt_template?: undefined | string; + response?: undefined | string; + trace_number?: number; } export type ModelConfig = { @@ -196,6 +231,7 @@ export type PredictResponse = { export type Query = { bool?: BoolQuery; + match?: Match; match_all?: MatchAllQuery; term?: Term; } @@ -214,7 +250,7 @@ export type SearchConnectorsResponse = SearchResponse export type SearchHits = { hits: SearchHitsHit[]; - max_score?: number; + max_score?: undefined | number; total: HitsTotal; } @@ -227,8 +263,13 @@ export type SearchHitsHit = { _source?: Source; _version?: Common.VersionNumber; model_id?: Common.Name; + sort?: number[]; } +export type SearchMemoryResponse = SearchResponse + +export type SearchMessageResponse = SearchResponse + export type SearchModelGroupsResponse = SearchResponse export type SearchModelsResponse = SearchResponse @@ -265,6 +306,31 @@ export type Sort = { total_chunks?: SortOrder; } +export type SortMemory = { + _id?: SortOrder; + _index?: SortOrder; + _score?: SortOrder; + _seq_no?: SortOrder; + additional_info?: SortOrder; + application_time?: SortOrder; + create_time?: SortOrder; + updated_time?: SortOrder; + user?: SortOrder; +} + +export type SortMessage = { + _id?: SortOrder; + _index?: SortOrder; + _score?: SortOrder; + _seq_no?: SortOrder; + additional_info?: SortOrder; + create_time?: SortOrder; + memory_id?: SortOrder; + origin?: SortOrder; + parent_message_id?: SortOrder; + trace_number?: SortOrder; +} + export type SortOrder = { order?: 'asc' | 'desc'; } @@ -272,20 +338,25 @@ export type SortOrder = { export type Source = { access?: 'private' | 'public' | 'restricted'; actions?: Action[]; + additional_info?: AdditionalInfo; algorithm?: string; + application_type?: undefined | string; auto_redeploy_retry_times?: number; backend_roles?: string[]; chunk_number?: number; connector_id?: string; + create_time?: string; created_time?: number; current_worker_node_count?: number; deploy_to_all_nodes?: boolean; description?: string; + input?: undefined | string; is_hidden?: boolean; last_deployed_time?: number; last_registered_time?: number; last_updated_time?: number; latest_version?: number; + memory_id?: Common.Name; model_config?: ModelConfig; model_content_hash_value?: string; model_content_size_in_bytes?: number; @@ -295,14 +366,21 @@ export type Source = { model_state?: 'DEPLOYED' | 'DEPLOYING' | 'DEPLOY_FAILED' | 'PARTIALLY_DEPLOYED' | 'REGISTERED' | 'REGISTERING' | 'UNDEPLOYED'; model_task_type?: string; model_version?: string; - name?: string; + name?: Common.Name; + origin?: undefined | string; owner?: Owner; parameters?: Parameters; + parent_message_id?: undefined | string; planning_worker_node_count?: number; planning_worker_nodes?: Common.NodeIds[]; + prompt_template?: undefined | string; protocol?: 'aws_sigv4' | 'http'; + response?: undefined | string; total_chunks?: number; + trace_number?: undefined | string; + updated_time?: string; url?: string; + user?: string; version?: Common.VersionString; } @@ -325,6 +403,7 @@ export type Term = { _id?: Common.Id[]; algorithm?: Algorithm; model_id?: Common.Name; + name?: OwnerNameKeyword; 'owner.name.keyword'?: OwnerNameKeyword; } diff --git a/api/_types/nodes.info.d.ts b/api/_types/nodes.info.d.ts index d8d637c7d..251b6b465 100644 --- a/api/_types/nodes.info.d.ts +++ b/api/_types/nodes.info.d.ts @@ -156,8 +156,8 @@ export type NodeInfoSearch = { } export type NodeInfoSearchPipelines = { - request_processors: NodeInfoIngestProcessor[]; - response_processors: NodeInfoIngestProcessor[]; + request_processors?: NodeInfoIngestProcessor[]; + response_processors?: NodeInfoIngestProcessor[]; } export type NodeInfoSearchRemote = { @@ -203,10 +203,16 @@ export type NodeInfoSettingsDeprecationIndexing = { export type NodeInfoSettingsHttp = { compression?: Common.StringifiedBoolean; port?: Common.StringifiedInteger; - type: string; + type: NodeInfoSettingsHttpType; 'type.default'?: string; } +export type NodeInfoSettingsHttpType = string | NodeInfoSettingsHttpTypeConfig + +export type NodeInfoSettingsHttpTypeConfig = { + default?: string; +} + export type NodeInfoSettingsIndex = { store?: NodeInfoSettingsIndexStore; } @@ -265,7 +271,7 @@ export type NodeInfoSettingsNetwork = { } export type NodeInfoSettingsNode = { - attr: Record; + attr?: Record; max_local_storage_nodes?: string; name: Common.Name; } @@ -273,10 +279,16 @@ export type NodeInfoSettingsNode = { export type NodeInfoSettingsPlugins = Record export type NodeInfoSettingsTransport = { - type: string; + type: NodeInfoSettingsTransportType; 'type.default'?: string; } +export type NodeInfoSettingsTransportType = string | NodeInfoSettingsTransportTypeConfig + +export type NodeInfoSettingsTransportTypeConfig = { + default?: string; +} + export type NodeInfoTransport = { bound_address: string[]; profiles: Record; diff --git a/api/cat/allPitSegments.d.ts b/api/cat/allPitSegments.d.ts index 17443b772..99cff4073 100644 --- a/api/cat/allPitSegments.d.ts +++ b/api/cat/allPitSegments.d.ts @@ -15,7 +15,7 @@ */ import { ApiResponse } from '../../lib/Transport' -import * as Cat_Common from '../_types/cat._common' +import * as Cat_Segments from '../_types/cat.segments' import * as Common from '../_types/_common' import * as Global from '../_types/_global' @@ -32,5 +32,5 @@ export interface Cat_AllPitSegments_Response extends ApiResponse { body: Cat_AllPitSegments_ResponseBody; } -export type Cat_AllPitSegments_ResponseBody = Cat_Common.CatPitSegmentsRecord[] +export type Cat_AllPitSegments_ResponseBody = Cat_Segments.SegmentsRecord[] diff --git a/api/cat/nodes.d.ts b/api/cat/nodes.d.ts index 426ebdd38..90366d5c0 100644 --- a/api/cat/nodes.d.ts +++ b/api/cat/nodes.d.ts @@ -23,7 +23,7 @@ export interface Cat_Nodes_Request extends Global.Params { bytes?: Common.ByteUnit; cluster_manager_timeout?: Common.Duration; format?: string; - full_id?: boolean | string; + full_id?: Common.StringifiedBoolean; h?: string[]; help?: boolean; local?: boolean; diff --git a/api/cat/nodes.js b/api/cat/nodes.js index 2c49ea699..e40b5ce87 100644 --- a/api/cat/nodes.js +++ b/api/cat/nodes.js @@ -28,7 +28,7 @@ const { normalizeArguments } = require('../utils'); * @param {string} [params.bytes] - The units used to display byte values. * @param {string} [params.cluster_manager_timeout] - The amount of time allowed to establish a connection to the cluster manager node. * @param {string} [params.format] - A short version of the `Accept` header, such as `json` or `yaml`. - * @param {string} [params.full_id=false] - When `true`, returns the full node ID. When `false`, returns the shortened node ID. + * @param {string} [params.full_id] - When `true`, returns the full node ID. When `false`, returns the shortened node ID. * @param {array} [params.h] - A comma-separated list of column names to display. * @param {boolean} [params.help=false] - Return help information. * @param {boolean} [params.local=false] DEPRECATED - Returns local information but does not retrieve the state from the cluster manager node. diff --git a/api/cat/pitSegments.d.ts b/api/cat/pitSegments.d.ts index 7f0d54404..daa2f290e 100644 --- a/api/cat/pitSegments.d.ts +++ b/api/cat/pitSegments.d.ts @@ -15,7 +15,7 @@ */ import { ApiResponse } from '../../lib/Transport' -import * as Cat_Common from '../_types/cat._common' +import * as Cat_Segments from '../_types/cat.segments' import * as Common from '../_types/_common' import * as Global from '../_types/_global' @@ -37,5 +37,5 @@ export interface Cat_PitSegments_Response extends ApiResponse { body: Cat_PitSegments_ResponseBody; } -export type Cat_PitSegments_ResponseBody = Cat_Common.CatPitSegmentsRecord[] +export type Cat_PitSegments_ResponseBody = Cat_Segments.SegmentsRecord[] diff --git a/api/cat/segmentReplication.d.ts b/api/cat/segmentReplication.d.ts index 742da1a21..3f51bf274 100644 --- a/api/cat/segmentReplication.d.ts +++ b/api/cat/segmentReplication.d.ts @@ -15,7 +15,7 @@ */ import { ApiResponse } from '../../lib/Transport' -import * as Cat_Common from '../_types/cat._common' +import * as Cat_SegmentReplication from '../_types/cat.segment_replication' import * as Common from '../_types/_common' import * as Global from '../_types/_global' @@ -43,5 +43,5 @@ export interface Cat_SegmentReplication_Response extends ApiResponse { body: Cat_SegmentReplication_ResponseBody; } -export type Cat_SegmentReplication_ResponseBody = Cat_Common.CatSegmentReplicationRecord[] +export type Cat_SegmentReplication_ResponseBody = Cat_SegmentReplication.SegmentReplicationRecord[] diff --git a/api/index.d.ts b/api/index.d.ts index 7d1553e6e..c2f847534 100644 --- a/api/index.d.ts +++ b/api/index.d.ts @@ -285,6 +285,16 @@ import { Ml_SearchConnectors_Request, Ml_SearchConnectors_RequestBody, Ml_Search import { Ml_DeleteConnector_Request, Ml_DeleteConnector_Response, Ml_DeleteConnector_ResponseBody } from './ml/deleteConnector'; import { Ml_GetConnector_Request, Ml_GetConnector_Response, Ml_GetConnector_ResponseBody } from './ml/getConnector'; import { Ml_UpdateConnector_Request, Ml_UpdateConnector_RequestBody, Ml_UpdateConnector_Response, Ml_UpdateConnector_ResponseBody } from './ml/updateConnector'; +import { Ml_GetMemory_Request, Ml_GetMemory_RequestBody, Ml_GetMemory_Response, Ml_GetMemory_ResponseBody } from './ml/getMemory'; +import { Ml_CreateMemory_Request, Ml_CreateMemory_RequestBody, Ml_CreateMemory_Response, Ml_CreateMemory_ResponseBody } from './ml/createMemory'; +import { Ml_SearchMemory_Request, Ml_SearchMemory_RequestBody, Ml_SearchMemory_Response, Ml_SearchMemory_ResponseBody } from './ml/searchMemory'; +import { Ml_DeleteMemory_Request, Ml_DeleteMemory_Response, Ml_DeleteMemory_ResponseBody } from './ml/deleteMemory'; +import { Ml_UpdateMemory_Request, Ml_UpdateMemory_RequestBody, Ml_UpdateMemory_Response, Ml_UpdateMemory_ResponseBody } from './ml/updateMemory'; +import { Ml_SearchMessage_Request, Ml_SearchMessage_RequestBody, Ml_SearchMessage_Response, Ml_SearchMessage_ResponseBody } from './ml/searchMessage'; +import { Ml_GetMessage_Request, Ml_GetMessage_Response, Ml_GetMessage_ResponseBody } from './ml/getMessage'; +import { Ml_CreateMessage_Request, Ml_CreateMessage_RequestBody, Ml_CreateMessage_Response, Ml_CreateMessage_ResponseBody } from './ml/createMessage'; +import { Ml_UpdateMessage_Request, Ml_UpdateMessage_RequestBody, Ml_UpdateMessage_Response, Ml_UpdateMessage_ResponseBody } from './ml/updateMessage'; +import { Ml_GetMessageTraces_Request, Ml_GetMessageTraces_Response, Ml_GetMessageTraces_ResponseBody } from './ml/getMessageTraces'; import { Ml_RegisterModelGroup_Request, Ml_RegisterModelGroup_RequestBody, Ml_RegisterModelGroup_Response, Ml_RegisterModelGroup_ResponseBody } from './ml/registerModelGroup'; import { Ml_SearchModelGroup_Request, Ml_SearchModelGroup_RequestBody, Ml_SearchModelGroup_Response, Ml_SearchModelGroup_ResponseBody } from './ml/searchModelGroup'; import { Ml_DeleteModelGroup_Request, Ml_DeleteModelGroup_Response, Ml_DeleteModelGroup_ResponseBody } from './ml/deleteModelGroup'; @@ -656,6 +666,16 @@ export { Ml_DeleteConnector_Request, Ml_DeleteConnector_Response, Ml_DeleteConnector_ResponseBody, Ml_GetConnector_Request, Ml_GetConnector_Response, Ml_GetConnector_ResponseBody, Ml_UpdateConnector_Request, Ml_UpdateConnector_RequestBody, Ml_UpdateConnector_Response, Ml_UpdateConnector_ResponseBody, + Ml_GetMemory_Request, Ml_GetMemory_RequestBody, Ml_GetMemory_Response, Ml_GetMemory_ResponseBody, + Ml_CreateMemory_Request, Ml_CreateMemory_RequestBody, Ml_CreateMemory_Response, Ml_CreateMemory_ResponseBody, + Ml_SearchMemory_Request, Ml_SearchMemory_RequestBody, Ml_SearchMemory_Response, Ml_SearchMemory_ResponseBody, + Ml_DeleteMemory_Request, Ml_DeleteMemory_Response, Ml_DeleteMemory_ResponseBody, + Ml_UpdateMemory_Request, Ml_UpdateMemory_RequestBody, Ml_UpdateMemory_Response, Ml_UpdateMemory_ResponseBody, + Ml_SearchMessage_Request, Ml_SearchMessage_RequestBody, Ml_SearchMessage_Response, Ml_SearchMessage_ResponseBody, + Ml_GetMessage_Request, Ml_GetMessage_Response, Ml_GetMessage_ResponseBody, + Ml_CreateMessage_Request, Ml_CreateMessage_RequestBody, Ml_CreateMessage_Response, Ml_CreateMessage_ResponseBody, + Ml_UpdateMessage_Request, Ml_UpdateMessage_RequestBody, Ml_UpdateMessage_Response, Ml_UpdateMessage_ResponseBody, + Ml_GetMessageTraces_Request, Ml_GetMessageTraces_Response, Ml_GetMessageTraces_ResponseBody, Ml_RegisterModelGroup_Request, Ml_RegisterModelGroup_RequestBody, Ml_RegisterModelGroup_Response, Ml_RegisterModelGroup_ResponseBody, Ml_SearchModelGroup_Request, Ml_SearchModelGroup_RequestBody, Ml_SearchModelGroup_Response, Ml_SearchModelGroup_ResponseBody, Ml_DeleteModelGroup_Request, Ml_DeleteModelGroup_Response, Ml_DeleteModelGroup_ResponseBody, diff --git a/api/ml/_api.js b/api/ml/_api.js index f798bef39..a89b456a0 100644 --- a/api/ml/_api.js +++ b/api/ml/_api.js @@ -20,13 +20,19 @@ function MlApi(bindObj) { this.createConnector = require('./createConnector').bind(bindObj); + this.createMemory = require('./createMemory').bind(bindObj); + this.createMessage = require('./createMessage').bind(bindObj); this.deleteAgent = require('./deleteAgent').bind(bindObj); this.deleteConnector = require('./deleteConnector').bind(bindObj); + this.deleteMemory = require('./deleteMemory').bind(bindObj); this.deleteModel = require('./deleteModel').bind(bindObj); this.deleteModelGroup = require('./deleteModelGroup').bind(bindObj); this.deleteTask = require('./deleteTask').bind(bindObj); this.deployModel = require('./deployModel').bind(bindObj); this.getConnector = require('./getConnector').bind(bindObj); + this.getMemory = require('./getMemory').bind(bindObj); + this.getMessage = require('./getMessage').bind(bindObj); + this.getMessageTraces = require('./getMessageTraces').bind(bindObj); this.getModelGroup = require('./getModelGroup').bind(bindObj); this.getTask = require('./getTask').bind(bindObj); this.predict = require('./predict').bind(bindObj); @@ -34,20 +40,30 @@ function MlApi(bindObj) { this.registerModel = require('./registerModel').bind(bindObj); this.registerModelGroup = require('./registerModelGroup').bind(bindObj); this.searchConnectors = require('./searchConnectors').bind(bindObj); + this.searchMemory = require('./searchMemory').bind(bindObj); + this.searchMessage = require('./searchMessage').bind(bindObj); this.searchModelGroup = require('./searchModelGroup').bind(bindObj); this.searchModels = require('./searchModels').bind(bindObj); this.train = require('./train').bind(bindObj); this.trainPredict = require('./trainPredict').bind(bindObj); this.undeployModel = require('./undeployModel').bind(bindObj); this.updateConnector = require('./updateConnector').bind(bindObj); + this.updateMemory = require('./updateMemory').bind(bindObj); + this.updateMessage = require('./updateMessage').bind(bindObj); this.updateModelGroup = require('./updateModelGroup').bind(bindObj); // Deprecated: Use createConnector instead. this.create_connector = require('./createConnector').bind(bindObj); + // Deprecated: Use createMemory instead. + this.create_memory = require('./createMemory').bind(bindObj); + // Deprecated: Use createMessage instead. + this.create_message = require('./createMessage').bind(bindObj); // Deprecated: Use deleteAgent instead. this.delete_agent = require('./deleteAgent').bind(bindObj); // Deprecated: Use deleteConnector instead. this.delete_connector = require('./deleteConnector').bind(bindObj); + // Deprecated: Use deleteMemory instead. + this.delete_memory = require('./deleteMemory').bind(bindObj); // Deprecated: Use deleteModel instead. this.delete_model = require('./deleteModel').bind(bindObj); // Deprecated: Use deleteModelGroup instead. @@ -58,6 +74,12 @@ function MlApi(bindObj) { this.deploy_model = require('./deployModel').bind(bindObj); // Deprecated: Use getConnector instead. this.get_connector = require('./getConnector').bind(bindObj); + // Deprecated: Use getMemory instead. + this.get_memory = require('./getMemory').bind(bindObj); + // Deprecated: Use getMessage instead. + this.get_message = require('./getMessage').bind(bindObj); + // Deprecated: Use getMessageTraces instead. + this.get_message_traces = require('./getMessageTraces').bind(bindObj); // Deprecated: Use getModelGroup instead. this.get_model_group = require('./getModelGroup').bind(bindObj); // Deprecated: Use getTask instead. @@ -70,6 +92,10 @@ function MlApi(bindObj) { this.register_model_group = require('./registerModelGroup').bind(bindObj); // Deprecated: Use searchConnectors instead. this.search_connectors = require('./searchConnectors').bind(bindObj); + // Deprecated: Use searchMemory instead. + this.search_memory = require('./searchMemory').bind(bindObj); + // Deprecated: Use searchMessage instead. + this.search_message = require('./searchMessage').bind(bindObj); // Deprecated: Use searchModelGroup instead. this.search_model_group = require('./searchModelGroup').bind(bindObj); // Deprecated: Use searchModels instead. @@ -80,6 +106,10 @@ function MlApi(bindObj) { this.undeploy_model = require('./undeployModel').bind(bindObj); // Deprecated: Use updateConnector instead. this.update_connector = require('./updateConnector').bind(bindObj); + // Deprecated: Use updateMemory instead. + this.update_memory = require('./updateMemory').bind(bindObj); + // Deprecated: Use updateMessage instead. + this.update_message = require('./updateMessage').bind(bindObj); // Deprecated: Use updateModelGroup instead. this.update_model_group = require('./updateModelGroup').bind(bindObj); } diff --git a/api/ml/createMemory.d.ts b/api/ml/createMemory.d.ts new file mode 100644 index 000000000..84917c889 --- /dev/null +++ b/api/ml/createMemory.d.ts @@ -0,0 +1,36 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +import { ApiResponse } from '../../lib/Transport' +import * as Common from '../_types/_common' +import * as Global from '../_types/_global' + +export interface Ml_CreateMemory_Request extends Global.Params { + body?: Ml_CreateMemory_RequestBody; +} + +export type Ml_CreateMemory_RequestBody = { + name?: Common.Name; +} + +export interface Ml_CreateMemory_Response extends ApiResponse { + body: Ml_CreateMemory_ResponseBody; +} + +export type Ml_CreateMemory_ResponseBody = { + memory_id: Common.Name; +} + diff --git a/api/ml/createMemory.js b/api/ml/createMemory.js new file mode 100644 index 000000000..3d806efe2 --- /dev/null +++ b/api/ml/createMemory.js @@ -0,0 +1,47 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +'use strict'; + +const { normalizeArguments } = require('../utils'); + +/** + * Create a memory. + *
See Also: {@link undefined - ml.create_memory} + * + * @memberOf API-Ml + * + * @param {object} [params] + * @param {object} [params.body] + * + * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ +function createMemoryFunc(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + + let { body, ...querystring } = params; + + const path = '/_plugins/_ml/memory'; + const method = 'POST'; + body = body || ''; + + return this.transport.request({ method, path, querystring, body }, options, callback); +} + +module.exports = createMemoryFunc; diff --git a/api/ml/createMessage.d.ts b/api/ml/createMessage.d.ts new file mode 100644 index 000000000..510025de5 --- /dev/null +++ b/api/ml/createMessage.d.ts @@ -0,0 +1,42 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +import { ApiResponse } from '../../lib/Transport' +import * as Common from '../_types/_common' +import * as Global from '../_types/_global' +import * as Ml_Common from '../_types/ml._common' + +export interface Ml_CreateMessage_Request extends Global.Params { + body?: Ml_CreateMessage_RequestBody; + memory_id: string; +} + +export type Ml_CreateMessage_RequestBody = { + additional_info?: Ml_Common.AdditionalInfo; + input?: string; + origin?: string; + prompt_template?: string; + response?: string; +} + +export interface Ml_CreateMessage_Response extends ApiResponse { + body: Ml_CreateMessage_ResponseBody; +} + +export type Ml_CreateMessage_ResponseBody = { + message_id: Common.Name; +} + diff --git a/api/ml/createMessage.js b/api/ml/createMessage.js new file mode 100644 index 000000000..f42e87772 --- /dev/null +++ b/api/ml/createMessage.js @@ -0,0 +1,50 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +'use strict'; + +const { normalizeArguments, parsePathParam, handleMissingParam } = require('../utils'); + +/** + * Create a message. + *
See Also: {@link undefined - ml.create_message} + * + * @memberOf API-Ml + * + * @param {object} params + * @param {string} params.memory_id + * @param {object} [params.body] + * + * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ +function createMessageFunc(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + if (params.memory_id == null) return handleMissingParam('memory_id', this, callback); + + let { body, memory_id, ...querystring } = params; + memory_id = parsePathParam(memory_id); + + const path = '/_plugins/_ml/memory/' + memory_id + '/messages'; + const method = 'POST'; + body = body || ''; + + return this.transport.request({ method, path, querystring, body }, options, callback); +} + +module.exports = createMessageFunc; diff --git a/api/ml/deleteMemory.d.ts b/api/ml/deleteMemory.d.ts new file mode 100644 index 000000000..f47554202 --- /dev/null +++ b/api/ml/deleteMemory.d.ts @@ -0,0 +1,31 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +import { ApiResponse } from '../../lib/Transport' +import * as Global from '../_types/_global' + +export interface Ml_DeleteMemory_Request extends Global.Params { + memory_id: string; +} + +export interface Ml_DeleteMemory_Response extends ApiResponse { + body: Ml_DeleteMemory_ResponseBody; +} + +export type Ml_DeleteMemory_ResponseBody = { + success: boolean; +} + diff --git a/api/ml/deleteMemory.js b/api/ml/deleteMemory.js new file mode 100644 index 000000000..1f962a186 --- /dev/null +++ b/api/ml/deleteMemory.js @@ -0,0 +1,49 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +'use strict'; + +const { normalizeArguments, parsePathParam, handleMissingParam } = require('../utils'); + +/** + * Delete a memory. + *
See Also: {@link undefined - ml.delete_memory} + * + * @memberOf API-Ml + * + * @param {object} params + * @param {string} params.memory_id + * + * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ +function deleteMemoryFunc(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + if (params.memory_id == null) return handleMissingParam('memory_id', this, callback); + + let { body, memory_id, ...querystring } = params; + memory_id = parsePathParam(memory_id); + + const path = '/_plugins/_ml/memory/' + memory_id; + const method = 'DELETE'; + body = body || ''; + + return this.transport.request({ method, path, querystring, body }, options, callback); +} + +module.exports = deleteMemoryFunc; diff --git a/api/ml/getMemory.d.ts b/api/ml/getMemory.d.ts new file mode 100644 index 000000000..b9d29b8ae --- /dev/null +++ b/api/ml/getMemory.d.ts @@ -0,0 +1,36 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +import { ApiResponse } from '../../lib/Transport' +import * as Global from '../_types/_global' +import * as Ml_Common from '../_types/ml._common' + +export interface Ml_GetMemory_Request extends Global.Params { + body?: Ml_GetMemory_RequestBody; + memory_id?: string; +} + +export type Ml_GetMemory_RequestBody = { + max_results?: number; + next_token?: number; +} + +export interface Ml_GetMemory_Response extends ApiResponse { + body: Ml_GetMemory_ResponseBody; +} + +export type Ml_GetMemory_ResponseBody = Ml_Common.GetMemoryResponse + diff --git a/api/ml/getMemory.js b/api/ml/getMemory.js new file mode 100644 index 000000000..2f4511500 --- /dev/null +++ b/api/ml/getMemory.js @@ -0,0 +1,49 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +'use strict'; + +const { normalizeArguments, parsePathParam } = require('../utils'); + +/** + * Get a memory. + *
See Also: {@link undefined - ml.get_memory} + * + * @memberOf API-Ml + * + * @param {object} [params] + * @param {string} [params.memory_id] + * @param {object} [params.body] + * + * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ +function getMemoryFunc(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + + let { body, memory_id, ...querystring } = params; + memory_id = parsePathParam(memory_id); + + const path = ['/_plugins/_ml/memory', memory_id].filter(c => c != null).join('/'); + const method = 'GET'; + body = body || ''; + + return this.transport.request({ method, path, querystring, body }, options, callback); +} + +module.exports = getMemoryFunc; diff --git a/api/ml/getMessage.d.ts b/api/ml/getMessage.d.ts new file mode 100644 index 000000000..1bb4333fd --- /dev/null +++ b/api/ml/getMessage.d.ts @@ -0,0 +1,31 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +import { ApiResponse } from '../../lib/Transport' +import * as Global from '../_types/_global' +import * as Ml_Common from '../_types/ml._common' + +export interface Ml_GetMessage_Request extends Global.Params { + memory_id?: string; + message_id?: string; +} + +export interface Ml_GetMessage_Response extends ApiResponse { + body: Ml_GetMessage_ResponseBody; +} + +export type Ml_GetMessage_ResponseBody = Ml_Common.GetMessageResponse + diff --git a/api/ml/getMessage.js b/api/ml/getMessage.js new file mode 100644 index 000000000..60a5ea8f9 --- /dev/null +++ b/api/ml/getMessage.js @@ -0,0 +1,55 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +'use strict'; + +const { normalizeArguments, parsePathParam } = require('../utils'); + +/** + * Get a message. + *
See Also: {@link undefined - ml.get_message} + * + * @memberOf API-Ml + * + * @param {object} [params] + * @param {string} [params.memory_id] + * @param {string} [params.message_id] + * + * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ +function getMessageFunc(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + + let { body, memory_id, message_id, ...querystring } = params; + memory_id = parsePathParam(memory_id); + message_id = parsePathParam(message_id); + + let path; + if (memory_id != null) { + path = '/_plugins/_ml/memory/' + memory_id + '/messages'; + } else { + path = '/_plugins/_ml/memory/message/' + message_id; + } + const method = 'GET'; + body = body || ''; + + return this.transport.request({ method, path, querystring, body }, options, callback); +} + +module.exports = getMessageFunc; diff --git a/api/ml/getMessageTraces.d.ts b/api/ml/getMessageTraces.d.ts new file mode 100644 index 000000000..b559aaf6c --- /dev/null +++ b/api/ml/getMessageTraces.d.ts @@ -0,0 +1,30 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +import { ApiResponse } from '../../lib/Transport' +import * as Global from '../_types/_global' +import * as Ml_Common from '../_types/ml._common' + +export interface Ml_GetMessageTraces_Request extends Global.Params { + message_id: string; +} + +export interface Ml_GetMessageTraces_Response extends ApiResponse { + body: Ml_GetMessageTraces_ResponseBody; +} + +export type Ml_GetMessageTraces_ResponseBody = Ml_Common.GetMessageTracesResponse + diff --git a/api/ml/getMessageTraces.js b/api/ml/getMessageTraces.js new file mode 100644 index 000000000..ff48c2417 --- /dev/null +++ b/api/ml/getMessageTraces.js @@ -0,0 +1,49 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +'use strict'; + +const { normalizeArguments, parsePathParam, handleMissingParam } = require('../utils'); + +/** + * Get a message traces. + *
See Also: {@link undefined - ml.get_message_traces} + * + * @memberOf API-Ml + * + * @param {object} params + * @param {string} params.message_id + * + * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ +function getMessageTracesFunc(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + if (params.message_id == null) return handleMissingParam('message_id', this, callback); + + let { body, message_id, ...querystring } = params; + message_id = parsePathParam(message_id); + + const path = '/_plugins/_ml/memory/message/' + message_id + '/traces'; + const method = 'GET'; + body = body || ''; + + return this.transport.request({ method, path, querystring, body }, options, callback); +} + +module.exports = getMessageTracesFunc; diff --git a/api/ml/searchMemory.d.ts b/api/ml/searchMemory.d.ts new file mode 100644 index 000000000..876688170 --- /dev/null +++ b/api/ml/searchMemory.d.ts @@ -0,0 +1,36 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +import { ApiResponse } from '../../lib/Transport' +import * as Global from '../_types/_global' +import * as Ml_Common from '../_types/ml._common' + +export interface Ml_SearchMemory_Request extends Global.Params { + body?: Ml_SearchMemory_RequestBody; +} + +export type Ml_SearchMemory_RequestBody = { + query?: Ml_Common.Query; + size?: number; + sort?: Ml_Common.SortMemory[]; +} + +export interface Ml_SearchMemory_Response extends ApiResponse { + body: Ml_SearchMemory_ResponseBody; +} + +export type Ml_SearchMemory_ResponseBody = Ml_Common.SearchMemoryResponse + diff --git a/api/ml/searchMemory.js b/api/ml/searchMemory.js new file mode 100644 index 000000000..4223fedff --- /dev/null +++ b/api/ml/searchMemory.js @@ -0,0 +1,47 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +'use strict'; + +const { normalizeArguments } = require('../utils'); + +/** + * Search memory. + *
See Also: {@link undefined - ml.search_memory} + * + * @memberOf API-Ml + * + * @param {object} [params] + * @param {object} [params.body] + * + * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ +function searchMemoryFunc(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + + let { body, ...querystring } = params; + + const path = '/_plugins/_ml/memory/_search'; + const method = body ? 'POST' : 'GET'; + body = body || ''; + + return this.transport.request({ method, path, querystring, body }, options, callback); +} + +module.exports = searchMemoryFunc; diff --git a/api/ml/searchMessage.d.ts b/api/ml/searchMessage.d.ts new file mode 100644 index 000000000..9c66b3683 --- /dev/null +++ b/api/ml/searchMessage.d.ts @@ -0,0 +1,37 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +import { ApiResponse } from '../../lib/Transport' +import * as Global from '../_types/_global' +import * as Ml_Common from '../_types/ml._common' + +export interface Ml_SearchMessage_Request extends Global.Params { + body?: Ml_SearchMessage_RequestBody; + memory_id: string; +} + +export type Ml_SearchMessage_RequestBody = { + query?: Ml_Common.Query; + size?: number; + sort?: Ml_Common.SortMessage[]; +} + +export interface Ml_SearchMessage_Response extends ApiResponse { + body: Ml_SearchMessage_ResponseBody; +} + +export type Ml_SearchMessage_ResponseBody = Ml_Common.SearchMessageResponse + diff --git a/api/ml/searchMessage.js b/api/ml/searchMessage.js new file mode 100644 index 000000000..5e2962305 --- /dev/null +++ b/api/ml/searchMessage.js @@ -0,0 +1,50 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +'use strict'; + +const { normalizeArguments, parsePathParam, handleMissingParam } = require('../utils'); + +/** + * Search messages. + *
See Also: {@link undefined - ml.search_message} + * + * @memberOf API-Ml + * + * @param {object} params + * @param {string} params.memory_id + * @param {object} [params.body] + * + * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ +function searchMessageFunc(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + if (params.memory_id == null) return handleMissingParam('memory_id', this, callback); + + let { body, memory_id, ...querystring } = params; + memory_id = parsePathParam(memory_id); + + const path = '/_plugins/_ml/memory/' + memory_id + '/_search'; + const method = body ? 'POST' : 'GET'; + body = body || ''; + + return this.transport.request({ method, path, querystring, body }, options, callback); +} + +module.exports = searchMessageFunc; diff --git a/api/ml/updateMemory.d.ts b/api/ml/updateMemory.d.ts new file mode 100644 index 000000000..5a363679f --- /dev/null +++ b/api/ml/updateMemory.d.ts @@ -0,0 +1,35 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +import { ApiResponse } from '../../lib/Transport' +import * as Common from '../_types/_common' +import * as Global from '../_types/_global' + +export interface Ml_UpdateMemory_Request extends Global.Params { + body?: Ml_UpdateMemory_RequestBody; + memory_id: string; +} + +export type Ml_UpdateMemory_RequestBody = { + name?: Common.Name; +} + +export interface Ml_UpdateMemory_Response extends ApiResponse { + body: Ml_UpdateMemory_ResponseBody; +} + +export type Ml_UpdateMemory_ResponseBody = Common.WriteResponseBase + diff --git a/api/ml/updateMemory.js b/api/ml/updateMemory.js new file mode 100644 index 000000000..9192e2ee4 --- /dev/null +++ b/api/ml/updateMemory.js @@ -0,0 +1,50 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +'use strict'; + +const { normalizeArguments, parsePathParam, handleMissingParam } = require('../utils'); + +/** + * Update a memory. + *
See Also: {@link undefined - ml.update_memory} + * + * @memberOf API-Ml + * + * @param {object} params + * @param {string} params.memory_id + * @param {object} [params.body] + * + * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ +function updateMemoryFunc(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + if (params.memory_id == null) return handleMissingParam('memory_id', this, callback); + + let { body, memory_id, ...querystring } = params; + memory_id = parsePathParam(memory_id); + + const path = '/_plugins/_ml/memory/' + memory_id; + const method = 'PUT'; + body = body || ''; + + return this.transport.request({ method, path, querystring, body }, options, callback); +} + +module.exports = updateMemoryFunc; diff --git a/api/ml/updateMessage.d.ts b/api/ml/updateMessage.d.ts new file mode 100644 index 000000000..4baa3ee42 --- /dev/null +++ b/api/ml/updateMessage.d.ts @@ -0,0 +1,40 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +import { ApiResponse } from '../../lib/Transport' +import * as Common from '../_types/_common' +import * as Global from '../_types/_global' +import * as Ml_Common from '../_types/ml._common' + +export interface Ml_UpdateMessage_Request extends Global.Params { + body?: Ml_UpdateMessage_RequestBody; + message_id: string; +} + +export type Ml_UpdateMessage_RequestBody = { + additional_info?: Ml_Common.AdditionalInfo; + input?: string; + origin?: string; + prompt_template?: string; + response?: string; +} + +export interface Ml_UpdateMessage_Response extends ApiResponse { + body: Ml_UpdateMessage_ResponseBody; +} + +export type Ml_UpdateMessage_ResponseBody = Common.WriteResponseBase + diff --git a/api/ml/updateMessage.js b/api/ml/updateMessage.js new file mode 100644 index 000000000..75ab93dbe --- /dev/null +++ b/api/ml/updateMessage.js @@ -0,0 +1,50 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + * + */ + +/* + * This file was generated from the OpenSearch API Spec. Do NOT edit it + * manually. If you want to make changes, either update the spec or + * modify the API generator. + */ + +'use strict'; + +const { normalizeArguments, parsePathParam, handleMissingParam } = require('../utils'); + +/** + * Update a message. + *
See Also: {@link undefined - ml.update_message} + * + * @memberOf API-Ml + * + * @param {object} params + * @param {string} params.message_id + * @param {object} [params.body] + * + * @param {TransportRequestOptions} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ +function updateMessageFunc(params, options, callback) { + [params, options, callback] = normalizeArguments(params, options, callback); + if (params.message_id == null) return handleMissingParam('message_id', this, callback); + + let { body, message_id, ...querystring } = params; + message_id = parsePathParam(message_id); + + const path = '/_plugins/_ml/memory/message/' + message_id; + const method = 'PUT'; + body = body || ''; + + return this.transport.request({ method, path, querystring, body }, options, callback); +} + +module.exports = updateMessageFunc;