Skip to content

Latest commit

 

History

History
659 lines (442 loc) · 21.8 KB

File metadata and controls

659 lines (442 loc) · 21.8 KB

cms_client.AnnotationsApi

All URIs are relative to http://localhost

Method HTTP request Description
extract_entities_from_multi_text_file POST /process_bulk_file Extract Entities From Multi Text File
get_entities_from_jsonlines_text POST /process_jsonl Get Entities From Jsonlines Text
get_entities_from_multiple_texts POST /process_bulk Get Entities From Multiple Texts
get_entities_from_text POST /process Get Entities From Text
get_entities_stream_from_jsonlines_stream POST /stream/process Get Entities Stream From Jsonlines Stream
get_entities_stream_from_sse GET /stream/sse/events Get Entities Stream From Sse
get_inline_entities_from_websocket_info GET /stream/ws Get Inline Entities From Websocket Info
send_text_jsonlines_for_processing POST /stream/sse/process Send Text Jsonlines For Processing

extract_entities_from_multi_text_file

extract_entities_from_multi_text_file(multi_text_file, tracking_id=tracking_id)

Extract Entities From Multi Text File

Upload a file containing a list of plain text and extract the NER entities in JSON

Example

  • OAuth Authentication (OAuth2PasswordBearer):
  • Api Key Authentication (APIKeyCookie):
import cms_client
from cms_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = cms_client.Configuration(
    host = "http://localhost"
)

# 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.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: APIKeyCookie
configuration.api_key['APIKeyCookie'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['APIKeyCookie'] = 'Bearer'

# Enter a context with an instance of the API client
with cms_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cms_client.AnnotationsApi(api_client)
    multi_text_file = None # bytearray | A file containing a list of plain texts, in the format of [\\\"text_1\\\", \\\"text_2\\\", ..., \\\"text_n\\\"]
    tracking_id = 'tracking_id_example' # str | The tracking ID of the requested task (optional)

    try:
        # Extract Entities From Multi Text File
        api_instance.extract_entities_from_multi_text_file(multi_text_file, tracking_id=tracking_id)
    except Exception as e:
        print("Exception when calling AnnotationsApi->extract_entities_from_multi_text_file: %s\n" % e)

Parameters

Name Type Description Notes
multi_text_file bytearray A file containing a list of plain texts, in the format of [\"text_1\", \"text_2\", ..., \"text_n\"]
tracking_id str The tracking ID of the requested task [optional]

Return type

void (empty response body)

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_entities_from_jsonlines_text

get_entities_from_jsonlines_text(body)

Get Entities From Jsonlines Text

Extract the NER entities from texts in the JSON Lines format

Example

  • OAuth Authentication (OAuth2PasswordBearer):
  • Api Key Authentication (APIKeyCookie):
import cms_client
from cms_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = cms_client.Configuration(
    host = "http://localhost"
)

# 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.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: APIKeyCookie
configuration.api_key['APIKeyCookie'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['APIKeyCookie'] = 'Bearer'

# Enter a context with an instance of the API client
with cms_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cms_client.AnnotationsApi(api_client)
    body = 'body_example' # str | 

    try:
        # Get Entities From Jsonlines Text
        api_instance.get_entities_from_jsonlines_text(body)
    except Exception as e:
        print("Exception when calling AnnotationsApi->get_entities_from_jsonlines_text: %s\n" % e)

Parameters

Name Type Description Notes
body str

Return type

void (empty response body)

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: application/x-ndjson
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_entities_from_multiple_texts

List[TextWithAnnotations] get_entities_from_multiple_texts(request_body)

Get Entities From Multiple Texts

Extract the NER entities from multiple plain texts

Example

  • OAuth Authentication (OAuth2PasswordBearer):
  • Api Key Authentication (APIKeyCookie):
import cms_client
from cms_client.models.text_with_annotations import TextWithAnnotations
from cms_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = cms_client.Configuration(
    host = "http://localhost"
)

# 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.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: APIKeyCookie
configuration.api_key['APIKeyCookie'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['APIKeyCookie'] = 'Bearer'

# Enter a context with an instance of the API client
with cms_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cms_client.AnnotationsApi(api_client)
    request_body = ['request_body_example'] # List[Optional[str]] | 

    try:
        # Get Entities From Multiple Texts
        api_response = api_instance.get_entities_from_multiple_texts(request_body)
        print("The response of AnnotationsApi->get_entities_from_multiple_texts:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AnnotationsApi->get_entities_from_multiple_texts: %s\n" % e)

Parameters

Name Type Description Notes
request_body List[Optional[str]]

Return type

List[TextWithAnnotations]

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_entities_from_text

TextWithAnnotations get_entities_from_text(body)

Get Entities From Text

Extract the NER entities from a single piece of plain text

Example

  • OAuth Authentication (OAuth2PasswordBearer):
  • Api Key Authentication (APIKeyCookie):
import cms_client
from cms_client.models.text_with_annotations import TextWithAnnotations
from cms_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = cms_client.Configuration(
    host = "http://localhost"
)

# 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.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: APIKeyCookie
configuration.api_key['APIKeyCookie'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['APIKeyCookie'] = 'Bearer'

# Enter a context with an instance of the API client
with cms_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cms_client.AnnotationsApi(api_client)
    body = 'body_example' # str | 

    try:
        # Get Entities From Text
        api_response = api_instance.get_entities_from_text(body)
        print("The response of AnnotationsApi->get_entities_from_text:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AnnotationsApi->get_entities_from_text: %s\n" % e)

Parameters

Name Type Description Notes
body str

Return type

TextWithAnnotations

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: text/plain
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_entities_stream_from_jsonlines_stream

object get_entities_stream_from_jsonlines_stream()

Get Entities Stream From Jsonlines Stream

Extract the NER entities from a stream of texts in the JSON Lines format

Example

  • OAuth Authentication (OAuth2PasswordBearer):
  • Api Key Authentication (APIKeyCookie):
import cms_client
from cms_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = cms_client.Configuration(
    host = "http://localhost"
)

# 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.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: APIKeyCookie
configuration.api_key['APIKeyCookie'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['APIKeyCookie'] = 'Bearer'

# Enter a context with an instance of the API client
with cms_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cms_client.AnnotationsApi(api_client)

    try:
        # Get Entities Stream From Jsonlines Stream
        api_response = api_instance.get_entities_stream_from_jsonlines_stream()
        print("The response of AnnotationsApi->get_entities_stream_from_jsonlines_stream:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AnnotationsApi->get_entities_stream_from_jsonlines_stream: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

object

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_entities_stream_from_sse

object get_entities_stream_from_sse(client_id, keep_alive=keep_alive)

Get Entities Stream From Sse

Server-Sent Events (SSE) endpoint to receive NER entities as stream events for a specific client

Example

import cms_client
from cms_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = cms_client.Configuration(
    host = "http://localhost"
)


# Enter a context with an instance of the API client
with cms_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cms_client.AnnotationsApi(api_client)
    client_id = 'client_id_example' # str | Unique client identifier for the SSE connection
    keep_alive = True # bool | Whether to keep the conneciton alive after periods of inactivity (optional)

    try:
        # Get Entities Stream From Sse
        api_response = api_instance.get_entities_stream_from_sse(client_id, keep_alive=keep_alive)
        print("The response of AnnotationsApi->get_entities_stream_from_sse:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AnnotationsApi->get_entities_stream_from_sse: %s\n" % e)

Parameters

Name Type Description Notes
client_id str Unique client identifier for the SSE connection
keep_alive bool Whether to keep the conneciton alive after periods of inactivity [optional]

Return type

object

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_inline_entities_from_websocket_info

WebSocketInfo get_inline_entities_from_websocket_info()

Get Inline Entities From Websocket Info

WebSocket info endpoint for real-time NER entity extraction. Use ws://host:port/stream/ws to establish an actual WebSocket connection.

Example

  • OAuth Authentication (OAuth2PasswordBearer):
  • Api Key Authentication (APIKeyCookie):
import cms_client
from cms_client.models.web_socket_info import WebSocketInfo
from cms_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = cms_client.Configuration(
    host = "http://localhost"
)

# 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.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: APIKeyCookie
configuration.api_key['APIKeyCookie'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['APIKeyCookie'] = 'Bearer'

# Enter a context with an instance of the API client
with cms_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cms_client.AnnotationsApi(api_client)

    try:
        # Get Inline Entities From Websocket Info
        api_response = api_instance.get_inline_entities_from_websocket_info()
        print("The response of AnnotationsApi->get_inline_entities_from_websocket_info:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AnnotationsApi->get_inline_entities_from_websocket_info: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

WebSocketInfo

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

send_text_jsonlines_for_processing

object send_text_jsonlines_for_processing(client_id)

Send Text Jsonlines For Processing

Sends texts in the JSON Lines format for processing and extracted NER entities will be received via Server-Sent Events (SSE).

Args: request (Request): The request object containing the texts in JSON Lines. client_id (str): The unique client identifier for the SSE connection. model_service (AbstractModelService): The model service dependency.

Returns: JSONResponse: A JSON response indicating the status of the request.

Example

  • OAuth Authentication (OAuth2PasswordBearer):
  • Api Key Authentication (APIKeyCookie):
import cms_client
from cms_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = cms_client.Configuration(
    host = "http://localhost"
)

# 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.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure API key authorization: APIKeyCookie
configuration.api_key['APIKeyCookie'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['APIKeyCookie'] = 'Bearer'

# Enter a context with an instance of the API client
with cms_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = cms_client.AnnotationsApi(api_client)
    client_id = 'client_id_example' # str | Unique client identifier for the SSE connection

    try:
        # Send Text Jsonlines For Processing
        api_response = api_instance.send_text_jsonlines_for_processing(client_id)
        print("The response of AnnotationsApi->send_text_jsonlines_for_processing:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AnnotationsApi->send_text_jsonlines_for_processing: %s\n" % e)

Parameters

Name Type Description Notes
client_id str Unique client identifier for the SSE connection

Return type

object

Authorization

OAuth2PasswordBearer, APIKeyCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
422 Validation Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]