ExtractorsApi

Method

HTTP request

Description

create_extractor

POST /extractors

Creates extractor.

delete_extractor

DELETE /extractors/{extractor-id}

Deletes extractor.

get_extractor

GET /extractors/{extractor-id}

Fetch an extractor by ID

list_extractors

GET /extractors

List extractors.

create_extractor

Extractor create_extractor(extractor_create_request)

Creates extractor.

Example

  • Bearer Authentication (bearerAuth):

import h2ogpte.rest_async
from h2ogpte.rest_async.models.extractor import Extractor
from h2ogpte.rest_async.models.extractor_create_request import ExtractorCreateRequest
from h2ogpte.rest_async.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://h2ogpte.genai.h2o.ai/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = h2ogpte.rest_async.Configuration(
    host = "https://h2ogpte.genai.h2o.ai/api/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: bearerAuth
configuration = h2ogpte.rest_async.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
async with h2ogpte.rest_async.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = h2ogpte.rest_async.ExtractorsApi(api_client)
    extractor_create_request = {"description":"Extracts medical data using Meta Llama 3.1-8B","llm":"meta-llama/Meta-Llama-3.1-8B-Instruct","name":"Medical data extractor","schema":"{\n  \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n  \"title\": \"H2O Field Editor Generated Schema\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"fields\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"clinic_name\": {\n          \"type\": \"string\"\n        },\n        \"patient_surname\": {\n          \"type\": \"string\"\n        },\n        \"patient_first_name\": {\n          \"type\": \"string\"\n        }\n      }\n    }\n  },\n  \"required\": [\n    \"fields\"\n  ]\n}\n"} # ExtractorCreateRequest | 

    try:
        # Creates extractor.
        api_response = await api_instance.create_extractor(extractor_create_request)
        print("The response of ExtractorsApi->create_extractor:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling ExtractorsApi->create_extractor: %s\n" % e)

Parameters

Name

Type

Description

Notes

extractor_create_request

ExtractorCreateRequest

Return type

Extractor

HTTP request headers

  • Content-Type: application/json

  • Accept: application/json

HTTP response details

Status code

Description

Response headers

200

OK

-

401

Unauthorized - Invalid or missing API key

-

404

Not found

-

delete_extractor

delete_extractor(extractor_id)

Deletes extractor.

Deletes extractor.

Example

  • Bearer Authentication (bearerAuth):

import h2ogpte.rest_async
from h2ogpte.rest_async.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://h2ogpte.genai.h2o.ai/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = h2ogpte.rest_async.Configuration(
    host = "https://h2ogpte.genai.h2o.ai/api/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: bearerAuth
configuration = h2ogpte.rest_async.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
async with h2ogpte.rest_async.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = h2ogpte.rest_async.ExtractorsApi(api_client)
    extractor_id = 'extractor_id_example' # str | ID of the extractor to delete.

    try:
        # Deletes extractor.
        await api_instance.delete_extractor(extractor_id)
    except Exception as e:
        print("Exception when calling ExtractorsApi->delete_extractor: %s\n" % e)

Parameters

Name

Type

Description

Notes

extractor_id

str

ID of the extractor to delete.

Return type

void (empty response body)

HTTP request headers

  • Content-Type: Not defined

  • Accept: application/json

HTTP response details

Status code

Description

Response headers

204

Successful operation

-

401

Unauthorized - Invalid or missing API key

-

get_extractor

Extractor get_extractor(extractor_id)

Fetch an extractor by ID

This endpoint retrieves information about a specific extractor based on its unique ID. It requires an authenticated user and returns a JSON response containing the extractor’s details.

Example

  • Bearer Authentication (bearerAuth):

import h2ogpte.rest_async
from h2ogpte.rest_async.models.extractor import Extractor
from h2ogpte.rest_async.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://h2ogpte.genai.h2o.ai/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = h2ogpte.rest_async.Configuration(
    host = "https://h2ogpte.genai.h2o.ai/api/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: bearerAuth
configuration = h2ogpte.rest_async.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
async with h2ogpte.rest_async.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = h2ogpte.rest_async.ExtractorsApi(api_client)
    extractor_id = 'extractor_id_example' # str | ID of the extractor to get.

    try:
        # Fetch an extractor by ID
        api_response = await api_instance.get_extractor(extractor_id)
        print("The response of ExtractorsApi->get_extractor:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling ExtractorsApi->get_extractor: %s\n" % e)

Parameters

Name

Type

Description

Notes

extractor_id

str

ID of the extractor to get.

Return type

Extractor

HTTP request headers

  • Content-Type: Not defined

  • Accept: application/json

HTTP response details

Status code

Description

Response headers

200

OK

-

401

Unauthorized - Invalid or missing API key

-

404

Not found

-

list_extractors

List[Extractor] list_extractors(offset=offset, limit=limit, name_filter=name_filter)

List extractors.

List extractors. The output is sorted by create time in descending order.

Example

  • Bearer Authentication (bearerAuth):

import h2ogpte.rest_async
from h2ogpte.rest_async.models.extractor import Extractor
from h2ogpte.rest_async.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://h2ogpte.genai.h2o.ai/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = h2ogpte.rest_async.Configuration(
    host = "https://h2ogpte.genai.h2o.ai/api/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: bearerAuth
configuration = h2ogpte.rest_async.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
async with h2ogpte.rest_async.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = h2ogpte.rest_async.ExtractorsApi(api_client)
    offset = 0 # int | How many extractors to skip before returning. (optional) (default to 0)
    limit = 100 # int | How many extractors to return. (optional) (default to 100)
    name_filter = 'name_filter_example' # str | Filter extractors by name. (optional)

    try:
        # List extractors.
        api_response = await api_instance.list_extractors(offset=offset, limit=limit, name_filter=name_filter)
        print("The response of ExtractorsApi->list_extractors:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling ExtractorsApi->list_extractors: %s\n" % e)

Parameters

Name

Type

Description

Notes

offset

int

How many extractors to skip before returning.

[optional] [default to 0]

limit

int

How many extractors to return.

[optional] [default to 100]

name_filter

str

Filter extractors by name.

[optional]

Return type

List[Extractor]

HTTP request headers

  • Content-Type: Not defined

  • Accept: application/json

HTTP response details

Status code

Description

Response headers

200

Successful operation. Fields llm and schema are not populated.

-

401

Unauthorized - Invalid or missing API key

-