- CLARIFAI API 基础知识
- API 接口
- annotation_filters
- annotations
- apps
- bulk_operations
- {id}
- List all the bulk operations
- delete one or more terminated bulk operations
- Perform bulk operations on a list of inputs based on input source. Operation include add, update, delete of concepts, metadata and geo data. This is an Asynchronous process. Use ListBulkOperations or GetBulkOperation to check the status.
- Cancel one or more bulk operations
- collectors
- {collectorId}
- List all the collectors.
- Delete multiple collectors in one request. This call is asynchronous. Use DeleteCollector if you want a synchronous version.
- Add a list of Collectors to an app. In the handler of this endpoint we also check for all the scopes of the POST /inputs endpoint. Those current scopes are listed here as a hard requirement. They are needed when adding the collectors just so we now that
- Patch one or more collectors.
- concepts
- datasets
- inputs
- {datasetId}
- inputs
- {inputId}
- List all the dataset inputs in a dataset.
- Delete one or more dataset inputs in a single request.
- Add dataset inputs to a dataset. The process is not atomic, i.e. if there are errors with some dataset inputs, others might still be added. The response reports - SUCCESS if all dataset inputs were added, - MIXED_STATUS if only some dataset inputs wer
- versions
- Get a specific dataset.
- inputs
- List all the datasets.
- Delete one or more datasets in a single request.
- Add datasets to an app. The process is atomic, i.e. either all or no datasets are added. If there is an error for one dataset, the process will stop, revert the transaction and return the error.
- Patch one or more datasets. The process is atomic, i.e. either all or no datasets are patched. If there is an error for one dataset, the process will stop, revert the transaction and return the error.
- evaluations
- inputs
- label_orders
- models
- searches
- types
- {modelId}
- check_consents
- inputs
- languages
- output_info
- outputs
- publish
- references
- toolkits
- unpublish
- usecases
- versions
- Get a specific model from an app.
- Delete a single model.
- List all the models.
- Delete multiple models in one request.
- Add a models to an app.
- Patch one or more models.
- modules
- my_scopes
- myscopes
- myscopesroot
- open_source_licenses
- resource_counts
- searches
- stats
- status_codes
- tasks
- trending_metrics
- uploads
- users
- {userAppId.userId}
- apps
- ids
- searches
- {userAppId.appId}
- annotation_filters
- annotations
- bulk_operations
- {id}
- List all the bulk operations
- delete one or more terminated bulk operations
- Perform bulk operations on a list of inputs based on input source. Operation include add, update, delete of concepts, metadata and geo data. This is an Asynchronous process. Use ListBulkOperations or GetBulkOperation to check the status.
- Cancel one or more bulk operations
- collaborators
- collectors
- {collectorId}
- List all the collectors.
- Delete multiple collectors in one request. This call is asynchronous. Use DeleteCollector if you want a synchronous version.
- Add a list of Collectors to an app. In the handler of this endpoint we also check for all the scopes of the POST /inputs endpoint. Those current scopes are listed here as a hard requirement. They are needed when adding the collectors just so we now that
- Patch one or more collectors.
- concepts
- knowledge_graphs
- mappings
- relations
- searches
- status
- {conceptId}
- languages
- relations
- List concept relations between concepts in the platform. MUST be above ListConcepts so that if concept_id is empty this will still match /concepts/relations to list all the concept relations in the app.
- Post concept relations to create relations between concepts in the platform.
- Post concept relations to create relations between concepts in the platform.
- Get a specific concept from an app.
- List all the concepts.
- Add a concept to an app.
- Patch one or more concepts.
- datasets
- inputs
- {datasetId}
- inputs
- {inputId}
- List all the dataset inputs in a dataset.
- Delete one or more dataset inputs in a single request.
- Add dataset inputs to a dataset. The process is not atomic, i.e. if there are errors with some dataset inputs, others might still be added. The response reports - SUCCESS if all dataset inputs were added, - MIXED_STATUS if only some dataset inputs wer
- versions
- Get a specific dataset.
- inputs
- List all the datasets.
- Delete one or more datasets in a single request.
- Add datasets to an app. The process is atomic, i.e. either all or no datasets are added. If there is an error for one dataset, the process will stop, revert the transaction and return the error.
- Patch one or more datasets. The process is atomic, i.e. either all or no datasets are patched. If there is an error for one dataset, the process will stop, revert the transaction and return the error.
- duplications
- evaluations
- inputs
- installed_module_versions
- {installedModuleVersionId}
- List installed modules vesrions for an app.
- Uninstall an installed module version which will deploy the specific ModuleVersion to the app in the url. This cleaned up any associated caller keys so needs the Keys_Delete scope.
- Install a new module version which will deploy the specific ModuleVersion to the app in the url.
- keys
- label_orders
- models
- ids
- searches
- types
- {modelId}
- check_consents
- concepts
- inputs
- languages
- output_info
- outputs
- publish
- references
- toolkits
- unpublish
- usecases
- versions
- Get a specific model from an app.
- Delete a single model.
- List all the models.
- Delete multiple models in one request.
- Add a models to an app.
- Patch one or more models.
- modules
- myscopes
- resource_counts
- searches
- stats
- task
- tasks
- trending_metrics
- uploads
- workflows
- Get a specific app from an app.GET
- Search over the apps to find one or more you're looking for. This leverage the "body" parameter because we also have page and per_page as url query param variables in this request.DELETE
- Patch one app.PATCH
- List all the apps.GET
- Add a app to an app. This needs to load the default workflow to make a copy, validating all the models in it, and then writing the new workflow back to this new app.POST
- Patch one or more apps.PATCH
- collaborations
- datasets
- duplications
- evaluations
- keys
- models
- modules
- myscopes
- runners
- scopes
- validate_password
- workflows
- Get user informationGET
- validate_password
- workflows
Execute a search over annotations
开发环境
开发环境
POST
/v2/users/{userAppId.userId}/apps/{userAppId.appId}/annotations/searches
V2
请求参数
Path 参数
userAppId.userId
string
必需
userAppId.appId
string
必需
Body 参数application/json
userAppId
object
The user_id and app_id to query from.
searches
array[object (apiSearch) {13}]
The searched to be executed or saved
query
object (apiQuery)
可选
id
string
可选
It is unique per application.
applicationId
string
可选
name
string
可选
asOf
string <date-time>
可选
retrieve the annotations satisfying the query.
gitHash
string
可选
createdAt
string <date-time>
可选
modifiedAt
string <date-time>
可选
algorithm
string
The search algorithm to be used.
Options are are 'nearest_neighbor', 'brute_force', and 'avg_concept_brute_force'
The last two perform a brute force search visual search instead of a more scalable distributed
nearest neighbor search and should be used by advanced users only.
If not specified we default to nearest neighbor
save
boolean
If true, save this search, and exit without executing the search.
If false execute the query
minValue
number <float>
可选
Defaults to 0.0 which means we won't do any thresholding as all probabilities will
likely be > 0.0.
visibility
object (clarifaiapiVisibility)
可选
When authenticating a request we can tell if a user is a collaborator or a teammate for the
the app that contains the resource and set their allowed visibility. We use that to restrict
what they are allowed to see:
If AllowedVisibility is PRIVATE then we allow PRIVATE (10), ORG (30), PUBLIC (50)
If AllowedVisibility is ORG then we allow ORG (30), PUBLIC (50)
If AllowedVisibility is PUBLIC then we allow PUBLIC (50) only.
metric
enum<string>
可选
Currently only brute force search supports non-eudlicean metrics.
枚举值:
METRIC_NOT_SETEUCLIDEAN_DISTANCECOSINE_DISTANCE
默认值:
METRIC_NOT_SET
pagination
object (apiPagination)
可选
page
integer <int64>
可选
perPage
integer <int64>
可选
示例
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://dev-cn.your-api-server.com/v2/users//apps//annotations/searches' \
--header 'Content-Type: application/json' \
--data-raw ''
返回响应
🟢200A successful response.
application/json
Body
status
object (apistatusStatus)
可选
code
object
可选
description
string
可选
details
string
可选
stackTrace
array[string]
可选
any issues.
percentCompleted
integer <int64>
specifically for long running jobs
timeRemaining
integer <int64>
if status is pending, how much time is remaining (in seconds)
reqId
string
If we want to return a request id in the base status field
internalDetails
string
可选
redirectInfo
object (statusRedirectInfo)
可选
id
string
A unique id which uniquely identifies a search
hits
array[object (Hit) {5}]
可选
score
number <float>
可选
between 0.0 and 1.0 as it represents a confidence in the search Hit. For example, if you search
for "car" and get a close matching Hit, the score should be close to 1.0. If you get a score
of close to 0.0 that means it's very disimilar to your query, in this case NOT a "car". There
is a special intermediate score of 0.5 that means that the Hit is not really correlated with
your search query (ie. not similar or dissimlar to the query) which is a common occurrence
when using negate queries.
Note: some queries that are just filtering down your app of inputs may just return a score of
1.0 for all Hits.
input
object (Input)
可选
annotation
object (Annotation of an asset with metadata)
可选
userId
string
可选
appId
string
可选
query
object (apiQuery)
可选
ands
array[object (apiAnd) {4}]
可选
results which are returned to the user as Hit messages.
and ranks instead with PostInputsSearches or PostAnnotationsSearches.
language
string
可选
based searches. This currently only affects public Models Output searches when those public
Models have translations for their Concepts.
filters
array[object (Filter) {4}]
filters in this query
e.q. only fetch annotations that have certain metadata
ranks
array[object (Rank) {2}]
rankings in this query
e.g. visual search by a url
searches
array[object (apiSearch) {13}]
可选
query
object (apiQuery)
可选
id
string
可选
It is unique per application.
applicationId
string
可选
name
string
可选
asOf
string <date-time>
可选
retrieve the annotations satisfying the query.
gitHash
string
可选
createdAt
string <date-time>
可选
modifiedAt
string <date-time>
可选
algorithm
string
The search algorithm to be used.
Options are are 'nearest_neighbor', 'brute_force', and 'avg_concept_brute_force'
The last two perform a brute force search visual search instead of a more scalable distributed
nearest neighbor search and should be used by advanced users only.
If not specified we default to nearest neighbor
save
boolean
If true, save this search, and exit without executing the search.
If false execute the query
minValue
number <float>
可选
Defaults to 0.0 which means we won't do any thresholding as all probabilities will
likely be > 0.0.
visibility
object (clarifaiapiVisibility)
可选
When authenticating a request we can tell if a user is a collaborator or a teammate for the
the app that contains the resource and set their allowed visibility. We use that to restrict
what they are allowed to see:
If AllowedVisibility is PRIVATE then we allow PRIVATE (10), ORG (30), PUBLIC (50)
If AllowedVisibility is ORG then we allow ORG (30), PUBLIC (50)
If AllowedVisibility is PUBLIC then we allow PUBLIC (50) only.
metric
enum<string>
可选
Currently only brute force search supports non-eudlicean metrics.
枚举值:
METRIC_NOT_SETEUCLIDEAN_DISTANCECOSINE_DISTANCE
默认值:
METRIC_NOT_SET
hitCounts
array[object (apiHitCount) {1}]
可选
Only returned if the request set only_count.
estimatedTotal
string <uint64>
可选
示例
🔴500An unexpected error response.
修改于 2023-12-11 04:16:54