-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[DOCS] Documents watsonx service of the Inference API #115088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
szabosteve
merged 3 commits into
elastic:main
from
szabosteve:watsonX-infer-service-docs
Oct 21, 2024
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
[[infer-service-watsonx-ai]] | ||
=== Watsonx {infer} service | ||
|
||
Creates an {infer} endpoint to perform an {infer} task with the `watsonxai` service. | ||
|
||
You need an https://cloud.ibm.com/docs/databases-for-elasticsearch?topic=databases-for-elasticsearch-provisioning&interface=api[IBM Cloud® Databases for Elasticsearch deployment] to use the `watsonxai` {infer} service. | ||
You can provision one through the https://cloud.ibm.com/databases/databases-for-elasticsearch/create[IBM catalog], the https://cloud.ibm.com/docs/databases-cli-plugin?topic=databases-cli-plugin-cdb-reference[Cloud Databases CLI plug-in], the https://cloud.ibm.com/apidocs/cloud-databases-api[Cloud Databases API], or https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/database[Terraform]. | ||
|
||
|
||
[discrete] | ||
[[infer-service-watsonx-ai-api-request]] | ||
==== {api-request-title} | ||
|
||
`PUT /_inference/<task_type>/<inference_id>` | ||
|
||
[discrete] | ||
[[infer-service-watsonx-ai-api-path-params]] | ||
==== {api-path-parms-title} | ||
|
||
`<inference_id>`:: | ||
(Required, string) | ||
include::inference-shared.asciidoc[tag=inference-id] | ||
|
||
`<task_type>`:: | ||
(Required, string) | ||
include::inference-shared.asciidoc[tag=task-type] | ||
+ | ||
-- | ||
Available task types: | ||
|
||
* `text_embedding`. | ||
-- | ||
|
||
[discrete] | ||
[[infer-service-watsonx-ai-api-request-body]] | ||
==== {api-request-body-title} | ||
|
||
`service`:: | ||
(Required, string) | ||
The type of service supported for the specified task type. In this case, | ||
`watsonxai`. | ||
|
||
`service_settings`:: | ||
(Required, object) | ||
include::inference-shared.asciidoc[tag=service-settings] | ||
+ | ||
-- | ||
These settings are specific to the `watsonxai` service. | ||
-- | ||
|
||
`api_key`::: | ||
(Required, string) | ||
A valid API key of your Watsonx account. | ||
You can find your Watsonx API keys or you can create a new one https://cloud.ibm.com/iam/apikeys[on the API keys page]. | ||
+ | ||
-- | ||
include::inference-shared.asciidoc[tag=api-key-admonition] | ||
-- | ||
|
||
`api_version`::: | ||
(Required, string) | ||
Version parameter that takes a version date in the format of `YYYY-MM-DD`. | ||
For the active version data parameters, refer to the https://cloud.ibm.com/apidocs/watsonx-ai#active-version-dates[documentation]. | ||
|
||
`model_id`::: | ||
(Required, string) | ||
The name of the model to use for the {infer} task. | ||
Refer to the IBM Embedding Models section in the https://www.ibm.com/products/watsonx-ai/foundation-models[Watsonx documentation] for the list of available text embedding models. | ||
|
||
`url`::: | ||
(Required, string) | ||
The URL endpoint to use for the requests. | ||
|
||
`project_id`::: | ||
(Required, string) | ||
The name of the project to use for the {infer} task. | ||
|
||
`rate_limit`::: | ||
(Optional, object) | ||
By default, the `watsonxai` service sets the number of requests allowed per minute to `3000`. | ||
This helps to minimize the number of rate limit errors returned from Watsonx. | ||
To modify this, set the `requests_per_minute` setting of this object in your service settings: | ||
+ | ||
-- | ||
include::inference-shared.asciidoc[tag=request-per-minute-example] | ||
-- | ||
|
||
|
||
[discrete] | ||
[[inference-example-watsonx-ai]] | ||
==== Watsonx AI service example | ||
|
||
The following example shows how to create an {infer} endpoint called `watsonx-embeddings` to perform a `text_embedding` task type. | ||
|
||
[source,console] | ||
------------------------------------------------------------ | ||
PUT _inference/text_embedding/watsonx-embeddings | ||
{ | ||
"service": "watsonxai", | ||
"service_settings": { | ||
"api_key": "<api_key>", <1> | ||
"url": "<url>", <2> | ||
"model_id": "ibm/slate-30m-english-rtrvr", | ||
"project_id": "<project_id>", <3> | ||
"api_version": "2024-03-14" <4> | ||
} | ||
} | ||
|
||
------------------------------------------------------------ | ||
// TEST[skip:TBD] | ||
<1> A valid Watsonx API key. | ||
You can find on the https://cloud.ibm.com/iam/apikeys[API keys page of your account]. | ||
<2> The {infer} endpoint URL you created on Watsonx. | ||
<3> The ID of your IBM Cloud project. | ||
<4> A valid API version parameter. You can find the active version data parameters https://cloud.ibm.com/apidocs/watsonx-ai#active-version-dates[here]. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.