Skip to content

Latest commit

 

History

History
240 lines (186 loc) · 12.6 KB

File metadata and controls

240 lines (186 loc) · 12.6 KB

cogstack-model-serve-client

CogStack Model Serve APIs

  • API version: 0.1.0
    • Generator version: 7.19.0

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven (3.8.3+)/Gradle (7.2+)

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>org.cms</groupId>
  <artifactId>cogstack-model-serve-client</artifactId>
  <version>0.1.0</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

  repositories {
    mavenCentral()     // Needed if the 'cogstack-model-serve-client' jar has been published to maven central.
    mavenLocal()       // Needed if the 'cogstack-model-serve-client' jar has been published to the local maven repo.
  }

  dependencies {
     implementation "org.cms:cogstack-model-serve-client:0.1.0"
  }

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/cogstack-model-serve-client-0.1.0.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

// Import classes:
import org.cms.client.ApiClient;
import org.cms.client.ApiException;
import org.cms.client.Configuration;
import org.cms.client.auth.*;
import org.cms.client.models.*;
import org.cms.client.api.AnnotationsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("http://localhost");
    
    // Configure OAuth2 access token for authorization: OAuth2PasswordBearer
    OAuth OAuth2PasswordBearer = (OAuth) defaultClient.getAuthentication("OAuth2PasswordBearer");
    OAuth2PasswordBearer.setAccessToken("YOUR ACCESS TOKEN");

    // Configure API key authorization: APIKeyCookie
    ApiKeyAuth APIKeyCookie = (ApiKeyAuth) defaultClient.getAuthentication("APIKeyCookie");
    APIKeyCookie.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //APIKeyCookie.setApiKeyPrefix("Token");

    AnnotationsApi apiInstance = new AnnotationsApi(defaultClient);
    File multiTextFile = new File("/path/to/file"); // File | A file containing a list of plain texts, in the format of [\\\"text_1\\\", \\\"text_2\\\", ..., \\\"text_n\\\"]
    String trackingId = "trackingId_example"; // String | The tracking ID of the requested task
    try {
      apiInstance.extractEntitiesFromMultiTextFile(multiTextFile, trackingId);
    } catch (ApiException e) {
      System.err.println("Exception when calling AnnotationsApi#extractEntitiesFromMultiTextFile");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
AnnotationsApi extractEntitiesFromMultiTextFile POST /process_bulk_file Extract Entities From Multi Text File
AnnotationsApi getEntitiesFromJsonlinesText POST /process_jsonl Get Entities From Jsonlines Text
AnnotationsApi getEntitiesFromMultipleTexts POST /process_bulk Get Entities From Multiple Texts
AnnotationsApi getEntitiesFromText POST /process Get Entities From Text
AnnotationsApi getEntitiesStreamFromJsonlinesStream POST /stream/process Get Entities Stream From Jsonlines Stream
AnnotationsApi getEntitiesStreamFromSse GET /stream/sse/events Get Entities Stream From Sse
AnnotationsApi getInlineEntitiesFromWebsocketInfo GET /stream/ws Get Inline Entities From Websocket Info
AnnotationsApi sendTextJsonlinesForProcessing POST /stream/sse/process Send Text Jsonlines For Processing
AuthenticationApi authCookieLogin POST /auth/cookie/login Auth:Cookie.Login
AuthenticationApi authCookieLogout POST /auth/cookie/logout Auth:Cookie.Logout
AuthenticationApi authJwtLogin POST /auth/jwt/login Auth:Jwt.Login
AuthenticationApi authJwtLogout POST /auth/jwt/logout Auth:Jwt.Logout
EmbeddingsApi getTextEmbeddings POST /embeddings Get Text Embeddings
EvaluatingApi getAnnotationStats POST /annotation-stats Get Annotation Stats
EvaluatingApi getConcatenatedTrainerExports POST /concat_trainer_exports Get Concatenated Trainer Exports
EvaluatingApi getInterAnnotatorAgreementScores POST /iaa-scores Get Inter Annotator Agreement Scores
EvaluatingApi getSanityCheckWithTrainerExport POST /sanity-check Get Sanity Check With Trainer Export
GenerateTextBasedOnTheInputPromptApi generateText POST /generate Generate Text
GenerateTextBasedOnTheInputPromptApi generateTextStream POST /stream/generate Generate Text Stream
MetadataApi getModelCard GET /info Get Model Card
OperationsCompatibleWithOllamaApisApi ollamaChat POST /ollama/api/chat Ollama Chat
OperationsCompatibleWithOllamaApisApi ollamaEmbed POST /ollama/api/embed Ollama Embed
OperationsCompatibleWithOllamaApisApi ollamaGenerate POST /ollama/api/generate Ollama Generate
OperationsCompatibleWithOllamaApisApi ollamaHealthGet GET /ollama/ Ollama Health Get
OperationsCompatibleWithOllamaApisApi ollamaHealthHead HEAD /ollama/ Ollama Health Head
OperationsCompatibleWithOllamaApisApi ollamaListTags GET /ollama/api/tags Ollama List Tags
OperationsCompatibleWithOllamaApisApi ollamaShowModel POST /ollama/api/show Ollama Show Model
OperationsCompatibleWithOllamaApisApi ollamaVersion GET /ollama/api/version Ollama Version
OperationsCompatibleWithOpenAiApisApi embedTexts POST /openai/v1/embeddings Embed Texts
OperationsCompatibleWithOpenAiApisApi generateChatCompletions POST /openai/v1/chat/completions Generate Chat Completions
OperationsCompatibleWithOpenAiApisApi generateTextCompletions POST /openai/v1/completions Generate Text Completions
OperationsCompatibleWithOpenAiApisApi getModel GET /openai/v1/models/{model_name} Get Model
OperationsCompatibleWithOpenAiApisApi listModels GET /openai/v1/models List Models
RedactionApi getRedactedText POST /redact Get Redacted Text
RedactionApi getRedactedTextWithEncryption POST /redact_with_encryption Get Redacted Text With Encryption
RenderingApi getRenderedEntitiesFromText POST /preview Get Rendered Entities From Text
RenderingApi getRenderedEntitiesFromTrainerExport POST /preview_trainer_export Get Rendered Entities From Trainer Export
TrainingApi cancelTraining POST /cancel_training Cancel Training
TrainingApi getEvaluationWithTrainerExport POST /evaluate Get Evaluation With Trainer Export
TrainingApi trainEvalInfo GET /train_eval_info Train Eval Info
TrainingApi trainEvalMetrics GET /train_eval_metrics Train Eval Metrics
TrainingApi trainMetacat POST /train_metacat Train Metacat
TrainingApi trainSupervised POST /train_supervised Train Supervised
TrainingApi trainUnsupervised POST /train_unsupervised Train Unsupervised
TrainingApi trainUnsupervisedWithHfDataset POST /train_unsupervised_with_hf_hub_dataset Train Unsupervised With Hf Dataset

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

OAuth2PasswordBearer

  • Type: OAuth
  • Flow: password
  • Authorization URL:
  • Scopes: N/A

APIKeyCookie

  • Type: API key
  • API key parameter name: fastapiusersauth
  • Location:

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author