Skip to content
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

Updated connector API documentation examples #2644

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

[source, python]
----
resp = client.perform_request(
"PUT",
"/_inference/text_embedding/my-e5-model",
headers={"Content-Type": "application/json"},
body={
resp = client.inference.put(
task_type="text_embedding",
inference_id="my-e5-model",
inference_config={
"service": "elasticsearch",
"service_settings": {
"num_allocations": 1,
Expand Down
12 changes: 4 additions & 8 deletions docs/examples/04412d11783dac25b5fd2ec5407078a3.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@

[source, python]
----
resp = client.perform_request(
"PUT",
"/_connector/my-connector/_api_key_id",
headers={"Content-Type": "application/json"},
body={
"api_key_id": "my-api-key-id",
"api_key_secret_id": "my-connector-secret-id"
},
resp = client.connector.update_api_key_id(
connector_id="my-connector",
api_key_id="my-api-key-id",
api_key_secret_id="my-connector-secret-id",
)
print(resp)
----
9 changes: 4 additions & 5 deletions docs/examples/04de2e3a9c00c2056b07bf9cf9e63a99.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

[source, python]
----
resp = client.perform_request(
"PUT",
"/_inference/text_embedding/google_vertex_ai_embeddings",
headers={"Content-Type": "application/json"},
body={
resp = client.inference.put(
task_type="text_embedding",
inference_id="google_vertex_ai_embeddings",
inference_config={
"service": "googlevertexai",
"service_settings": {
"service_account_json": "<service_account_json>",
Expand Down
9 changes: 4 additions & 5 deletions docs/examples/0ad8edd10542ec2c4d5d8700d7e2ba97.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

[source, python]
----
resp = client.perform_request(
"PUT",
"/_inference/text_embedding/amazon_bedrock_embeddings",
headers={"Content-Type": "application/json"},
body={
resp = client.inference.put(
task_type="text_embedding",
inference_id="amazon_bedrock_embeddings",
inference_config={
"service": "amazonbedrock",
"service_settings": {
"access_key": "<aws_access_key>",
Expand Down
44 changes: 20 additions & 24 deletions docs/examples/0ade87c8cb0e3c188d2e3dce279d5cc2.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,26 @@

[source, python]
----
resp = client.perform_request(
"PUT",
"/_connector/my-g-drive-connector/_filtering",
headers={"Content-Type": "application/json"},
body={
"rules": [
{
"field": "file_extension",
"id": "exclude-txt-files",
"order": 0,
"policy": "exclude",
"rule": "equals",
"value": "txt"
},
{
"field": "_",
"id": "DEFAULT",
"order": 1,
"policy": "include",
"rule": "regex",
"value": ".*"
}
]
},
resp = client.connector.update_filtering(
connector_id="my-g-drive-connector",
rules=[
{
"field": "file_extension",
"id": "exclude-txt-files",
"order": 0,
"policy": "exclude",
"rule": "equals",
"value": "txt"
},
{
"field": "_",
"id": "DEFAULT",
"order": 1,
"policy": "include",
"rule": "regex",
"value": ".*"
}
],
)
print(resp)
----
2 changes: 1 addition & 1 deletion docs/examples/0ea2167ce7c87d311b20c4f8c698a8d0.asciidoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is autogenerated, DO NOT EDIT
// search/point-in-time-api.asciidoc:152
// search/point-in-time-api.asciidoc:190

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/0fb7705ddbf1fc2b65d2de2e00fe5769.asciidoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is autogenerated, DO NOT EDIT
// aggregations/metrics/scripted-metric-aggregation.asciidoc:59
// aggregations/metrics/scripted-metric-aggregation.asciidoc:61

[source, python]
----
Expand Down
11 changes: 4 additions & 7 deletions docs/examples/13ecdf99114098c76b050397d9c3d4e6.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@

[source, python]
----
resp = client.perform_request(
"POST",
"/_inference/sparse_embedding/my-elser-model",
headers={"Content-Type": "application/json"},
body={
"input": "The sky above the port was the color of television tuned to a dead channel."
},
resp = client.inference.inference(
task_type="sparse_embedding",
inference_id="my-elser-model",
input="The sky above the port was the color of television tuned to a dead channel.",
)
print(resp)
----
2 changes: 1 addition & 1 deletion docs/examples/187733e50c60350f3f75921bea3b72c2.asciidoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:613
// search/search-your-data/paginate-search-results.asciidoc:615

[source, python]
----
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/19d60e4890cc57151d596326484d9076.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

[source, python]
----
resp = client.ingest.delete_geoip_database(
id="my-database-id",
body=None,
resp = client.perform_request(
"DELETE",
"/_ingest/geoip/database/my-database-id",
)
print(resp)
----
9 changes: 4 additions & 5 deletions docs/examples/1a56df055b94466ca76818e0858752c6.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

[source, python]
----
resp = client.perform_request(
"PUT",
"/_inference/text_embedding/openai_embeddings",
headers={"Content-Type": "application/json"},
body={
resp = client.inference.put(
task_type="text_embedding",
inference_id="openai_embeddings",
inference_config={
"service": "openai",
"service_settings": {
"api_key": "<api_key>",
Expand Down
9 changes: 4 additions & 5 deletions docs/examples/1a9e03ce0355872a7db27fedc783fbec.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

[source, python]
----
resp = client.perform_request(
"PUT",
"/_inference/rerank/google_vertex_ai_rerank",
headers={"Content-Type": "application/json"},
body={
resp = client.inference.put(
task_type="rerank",
inference_id="google_vertex_ai_rerank",
inference_config={
"service": "googlevertexai",
"service_settings": {
"service_account_json": "<service_account_json>",
Expand Down
9 changes: 4 additions & 5 deletions docs/examples/1b60ad542abb511cbd926ac8c55b609c.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

[source, python]
----
resp = client.perform_request(
"PUT",
"/_inference/sparse_embedding/my-elser-model",
headers={"Content-Type": "application/json"},
body={
resp = client.inference.put(
task_type="sparse_embedding",
inference_id="my-elser-model",
inference_config={
"service": "elser",
"service_settings": {
"adaptive_allocations": {
Expand Down
9 changes: 4 additions & 5 deletions docs/examples/1dadb7efe27b6c0c231eb6535e413bd9.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

[source, python]
----
resp = client.perform_request(
"PUT",
"/_inference/text_embedding/azure_ai_studio_embeddings",
headers={"Content-Type": "application/json"},
body={
resp = client.inference.put(
task_type="text_embedding",
inference_id="azure_ai_studio_embeddings",
inference_config={
"service": "azureaistudio",
"service_settings": {
"api_key": "<api_key>",
Expand Down
8 changes: 2 additions & 6 deletions docs/examples/1e26353d546d733634187b8c3a7837a7.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@

[source, python]
----
resp = client.perform_request(
"GET",
"/_connector",
params={
"service_type": "sharepoint_online"
},
resp = client.connector.list(
service_type="sharepoint_online",
)
print(resp)
----
9 changes: 4 additions & 5 deletions docs/examples/21cd01cb90d3ea1acd0ab22d7edd2c88.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

[source, python]
----
resp = client.perform_request(
"PUT",
"/_inference/text_embedding/azure_ai_studio_embeddings",
headers={"Content-Type": "application/json"},
body={
resp = client.inference.put(
task_type="text_embedding",
inference_id="azure_ai_studio_embeddings",
inference_config={
"service": "azureaistudio",
"service_settings": {
"api_key": "<api_key>",
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/24f4dfdf9922d5aa79151675b7767742.asciidoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:383
// search/search-your-data/paginate-search-results.asciidoc:385

[source, python]
----
Expand Down
14 changes: 5 additions & 9 deletions docs/examples/342ddf9121aeddd82fea2464665e25da.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@

[source, python]
----
resp = client.perform_request(
"PUT",
"/_connector/my-connector",
headers={"Content-Type": "application/json"},
body={
"index_name": "search-google-drive",
"name": "My Connector",
"service_type": "google_drive"
},
resp = client.connector.put(
connector_id="my-connector",
index_name="search-google-drive",
name="My Connector",
service_type="google_drive",
)
print(resp)
----
2 changes: 1 addition & 1 deletion docs/examples/3758b8f2ab9f6f28a764ee6c42c85766.asciidoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:548
// search/search-your-data/paginate-search-results.asciidoc:550

[source, python]
----
Expand Down
9 changes: 4 additions & 5 deletions docs/examples/398389933901b572a06a752bc780af7c.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

[source, python]
----
resp = client.perform_request(
"PUT",
"/_inference/completion/anthropic_completion",
headers={"Content-Type": "application/json"},
body={
resp = client.inference.put(
task_type="completion",
inference_id="anthropic_completion",
inference_config={
"service": "anthropic",
"service_settings": {
"api_key": "<api_key>",
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/3b6718257421b5419bf4cd6a7303c57e.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

[source, python]
----
resp = client.ingest.get_geoip_database(
id="my-database-id",
body=None,
resp = client.perform_request(
"GET",
"/_ingest/geoip/database/my-database-id",
)
print(resp)
----
18 changes: 7 additions & 11 deletions docs/examples/41175d304e660da2931764f9a4418fd3.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@

[source, python]
----
resp = client.perform_request(
"PUT",
"/_connector/my-connector/_pipeline",
headers={"Content-Type": "application/json"},
body={
"pipeline": {
"extract_binary_content": True,
"name": "my-connector-pipeline",
"reduce_whitespace": True,
"run_ml_inference": True
}
resp = client.connector.update_pipeline(
connector_id="my-connector",
pipeline={
"extract_binary_content": True,
"name": "my-connector-pipeline",
"reduce_whitespace": True,
"run_ml_inference": True
},
)
print(resp)
Expand Down
10 changes: 3 additions & 7 deletions docs/examples/430705509f8367aef92be413f702520b.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@

[source, python]
----
resp = client.perform_request(
"PUT",
"/_connector/my-connector/_status",
headers={"Content-Type": "application/json"},
body={
"status": "needs_configuration"
},
resp = client.connector.update_status(
connector_id="my-connector",
status="needs_configuration",
)
print(resp)
----
2 changes: 1 addition & 1 deletion docs/examples/4342ccf6cc24fd80bd3cd1f9a4c2ef8e.asciidoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:513
// search/search-your-data/paginate-search-results.asciidoc:515

[source, python]
----
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/47909e194d10743093f4a22c27a85925.asciidoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is autogenerated, DO NOT EDIT
// search/search-your-data/paginate-search-results.asciidoc:196
// search/search-your-data/paginate-search-results.asciidoc:198

[source, python]
----
Expand Down
Loading
Loading