Skip to content

ConceptApi

All URIs are relative to https://app.coactive.ai

Method HTTP request Description
create_concept POST /api/v0/concepts Create a new concept
delete_concept DELETE /api/v0/concepts/{concept_id} Delete concept by id
get_concept GET /api/v0/concepts/{concept_id} Get concept by id
get_concepts GET /api/v0/concepts Get paginated concepts
get_concepts_by_embedding GET /api/v0/embeddings/{embedding_id}/concepts Get concepts by embedding id
update_concept_by_id PATCH /api/v0/concepts/{concept_id} Update concept by id
validate_concept_name POST /api/v0/concepts/validate-name Validate concept name

create_concept

FullConceptResponse create_concept(create_concept_request)

Create a new concept

Example

  • Bearer Authentication (HTTPBearer):
import time
import coactive
from coactive.apis import ConceptApi
from coactive.model.full_concept_response import FullConceptResponse
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse
from coactive.model.create_concept_request import CreateConceptRequest

# Defining the host is optional and defaults to https://app.coactive.ai.

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


# Configure Bearer authorization: HTTPBearer


# See configuration.py for a list of all supported configuration parameters.

from YOUR_ENV import CLIENT_ID, CLIENT_SECRET


configuration = coactive.Configuration(
    host = "https://app.coactive.ai",
    access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)

# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ConceptApi(api_client)
    create_concept_request = CreateConceptRequest(
        name="TheNorth",
        description="Screenshots and clips from Game of Thrones that take place in the North",
        embedding_id="b78a6e5f-5434-46c4-9e4f-ded092147584",
        labels=[
            ConceptLabelRequest(
                coactive_image_id="a6894d72-612d-4c20-b4d0-8f3f21c2bb10",
                image_path="s3://your-s3-bucket/path/to/image.jpg",
                label=LabelEnum("1"),
            ),
        ],
        threshold=0.8,
    )

    # example passing only required values which don't have defaults set
    try:
        # Create a new concept
        api_response = api_instance.create_concept(create_concept_request)
        print(api_response)
    except coactive.ApiException as e:
        print("Exception when calling ConceptApi->create_concept: %s\n" % e)

Parameters

Name Type Description Notes
create_concept_request CreateConceptRequest

Return type

FullConceptResponse

Authorization

HTTPBearer

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 The created concept -
403 Authentication error -
401 Unauthorized -
404 Not found -
400 Invalid concept name -
422 Validation Error -

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

delete_concept

bool, date, datetime, dict, float, int, list, str, none_type delete_concept(concept_id)

Delete concept by id

Example

  • Bearer Authentication (HTTPBearer):
import time
import coactive
from coactive.apis import ConceptApi
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse

# Defining the host is optional and defaults to https://app.coactive.ai.

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


# Configure Bearer authorization: HTTPBearer


# See configuration.py for a list of all supported configuration parameters.

from YOUR_ENV import CLIENT_ID, CLIENT_SECRET


configuration = coactive.Configuration(
    host = "https://app.coactive.ai",
    access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)

# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ConceptApi(api_client)
    concept_id = "428e52cd-7ceb-490c-ae3f-0848c82d8c97"

    # example passing only required values which don't have defaults set
    try:
        # Delete concept by id
        api_response = api_instance.delete_concept(concept_id)
        print(api_response)
    except coactive.ApiException as e:
        print("Exception when calling ConceptApi->delete_concept: %s\n" % e)

Parameters

Name Type Description Notes
concept_id str The unique identifier for the concept

Return type

bool, date, datetime, dict, float, int, list, str, none_type

Authorization

HTTPBearer

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Successful Response -
403 Authentication error -
401 Unauthorized -
404 Not found -
422 Validation Error -

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

get_concept

FullConceptResponse get_concept(concept_id)

Get concept by id

Example

  • Bearer Authentication (HTTPBearer):
import time
import coactive
from coactive.apis import ConceptApi
from coactive.model.full_concept_response import FullConceptResponse
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse

# Defining the host is optional and defaults to https://app.coactive.ai.

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


# Configure Bearer authorization: HTTPBearer


# See configuration.py for a list of all supported configuration parameters.

from YOUR_ENV import CLIENT_ID, CLIENT_SECRET


configuration = coactive.Configuration(
    host = "https://app.coactive.ai",
    access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)

# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ConceptApi(api_client)
    concept_id = "428e52cd-7ceb-490c-ae3f-0848c82d8c97"

    # example passing only required values which don't have defaults set
    try:
        # Get concept by id
        api_response = api_instance.get_concept(concept_id)
        print(api_response)
    except coactive.ApiException as e:
        print("Exception when calling ConceptApi->get_concept: %s\n" % e)

Parameters

Name Type Description Notes
concept_id str The unique identifier for the concept

Return type

FullConceptResponse

Authorization

HTTPBearer

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Concept details -
403 Authentication error -
401 Unauthorized -
404 Not found -
422 Validation Error -

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

get_concepts

ConceptListResponse get_concepts()

Get paginated concepts, optionally filtered by datasets

Example

  • Bearer Authentication (HTTPBearer):
import time
import coactive
from coactive.apis import ConceptApi
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse
from coactive.model.concept_list_response import ConceptListResponse

# Defining the host is optional and defaults to https://app.coactive.ai.

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


# Configure Bearer authorization: HTTPBearer


# See configuration.py for a list of all supported configuration parameters.

from YOUR_ENV import CLIENT_ID, CLIENT_SECRET


configuration = coactive.Configuration(
    host = "https://app.coactive.ai",
    access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)

# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ConceptApi(api_client)
    datasets_to_include = ["556f4d52-a557-461e-a204-69236fd9c1e2"] # (optional)
    offset = 0 # (optional) if omitted the server will use the default value of 0
    limit = 100 # (optional) if omitted the server will use the default value of 100

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Get paginated concepts
        api_response = api_instance.get_concepts(datasets_to_include=datasets_to_include, offset=offset, limit=limit)
        print(api_response)
    except coactive.ApiException as e:
        print("Exception when calling ConceptApi->get_concepts: %s\n" % e)

Parameters

Name Type Description Notes
datasets_to_include [str], none_type Datasets to include in the list response [optional]
offset int, none_type Starting index to return [optional] if omitted the server will use the default value of 0
limit int, none_type Max number of items to return [optional] if omitted the server will use the default value of 100

Return type

ConceptListResponse

Authorization

HTTPBearer

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 All concepts -
403 Authentication error -
401 Unauthorized -
404 Not found -
422 Validation Error -

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

get_concepts_by_embedding

ConceptListResponse get_concepts_by_embedding(embedding_id)

Get concepts by embedding id

Example

  • Bearer Authentication (HTTPBearer):
import time
import coactive
from coactive.apis import ConceptApi
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse
from coactive.model.concept_list_response import ConceptListResponse

# Defining the host is optional and defaults to https://app.coactive.ai.

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


# Configure Bearer authorization: HTTPBearer


# See configuration.py for a list of all supported configuration parameters.

from YOUR_ENV import CLIENT_ID, CLIENT_SECRET


configuration = coactive.Configuration(
    host = "https://app.coactive.ai",
    access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)

# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ConceptApi(api_client)
    embedding_id = "b78a6e5f-5434-46c4-9e4f-ded092147584"
    offset = 0 # (optional) if omitted the server will use the default value of 0
    limit = 100 # (optional) if omitted the server will use the default value of 100

    # example passing only required values which don't have defaults set
    try:
        # Get concepts by embedding id
        api_response = api_instance.get_concepts_by_embedding(embedding_id)
        print(api_response)
    except coactive.ApiException as e:
        print("Exception when calling ConceptApi->get_concepts_by_embedding: %s\n" % e)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Get concepts by embedding id
        api_response = api_instance.get_concepts_by_embedding(embedding_id, offset=offset, limit=limit)
        print(api_response)
    except coactive.ApiException as e:
        print("Exception when calling ConceptApi->get_concepts_by_embedding: %s\n" % e)

Parameters

Name Type Description Notes
embedding_id str The unique identifier for the embedding
offset int, none_type Starting index to return [optional] if omitted the server will use the default value of 0
limit int, none_type Max number of items to return [optional] if omitted the server will use the default value of 100

Return type

ConceptListResponse

Authorization

HTTPBearer

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 List of concepts -
403 Authentication error -
401 Unauthorized -
404 Not found -
422 Validation Error -

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

update_concept_by_id

ConceptResponse update_concept_by_id(concept_id, update_concept_request)

Update concept by id

Example

  • Bearer Authentication (HTTPBearer):
import time
import coactive
from coactive.apis import ConceptApi
from coactive.model.update_concept_request import UpdateConceptRequest
from coactive.model.concept_response import ConceptResponse
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse

# Defining the host is optional and defaults to https://app.coactive.ai.

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


# Configure Bearer authorization: HTTPBearer


# See configuration.py for a list of all supported configuration parameters.

from YOUR_ENV import CLIENT_ID, CLIENT_SECRET


configuration = coactive.Configuration(
    host = "https://app.coactive.ai",
    access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)

# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ConceptApi(api_client)
    concept_id = "428e52cd-7ceb-490c-ae3f-0848c82d8c97"
    update_concept_request = UpdateConceptRequest(
        name="TheNorth",
        description="Screenshots and clips from Game of Thrones that take place in the North",
        threshold=0.8,
    )

    # example passing only required values which don't have defaults set
    try:
        # Update concept by id
        api_response = api_instance.update_concept_by_id(concept_id, update_concept_request)
        print(api_response)
    except coactive.ApiException as e:
        print("Exception when calling ConceptApi->update_concept_by_id: %s\n" % e)

Parameters

Name Type Description Notes
concept_id str The unique identifier for the concept
update_concept_request UpdateConceptRequest

Return type

ConceptResponse

Authorization

HTTPBearer

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Concept details -
403 Authentication error -
401 Unauthorized -
404 Not found -
422 Validation Error -

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

validate_concept_name

ValidateConceptNameResponse validate_concept_name(validate_concept_name_request)

Validate concept name contains allowable characters and check for uniqueness

Example

  • Bearer Authentication (HTTPBearer):
import time
import coactive
from coactive.apis import ConceptApi
from coactive.model.validate_concept_name_response import ValidateConceptNameResponse
from coactive.model.validate_concept_name_request import ValidateConceptNameRequest
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse

# Defining the host is optional and defaults to https://app.coactive.ai.

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


# Configure Bearer authorization: HTTPBearer


# See configuration.py for a list of all supported configuration parameters.

from YOUR_ENV import CLIENT_ID, CLIENT_SECRET


configuration = coactive.Configuration(
    host = "https://app.coactive.ai",
    access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)

# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ConceptApi(api_client)
    validate_concept_name_request = ValidateConceptNameRequest(
        name="TheNorth",
        embedding_id="b78a6e5f-5434-46c4-9e4f-ded092147584",
    )

    # example passing only required values which don't have defaults set
    try:
        # Validate concept name
        api_response = api_instance.validate_concept_name(validate_concept_name_request)
        print(api_response)
    except coactive.ApiException as e:
        print("Exception when calling ConceptApi->validate_concept_name: %s\n" % e)

Parameters

Name Type Description Notes
validate_concept_name_request ValidateConceptNameRequest

Return type

ValidateConceptNameResponse

Authorization

HTTPBearer

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Concept name validation -
403 Authentication error -
401 Unauthorized -
404 Not found -
422 Validation Error -

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