Crate aleph_alpha_api

Source
Expand description

§Inofficial Rust client library for the Aleph Alpha API

Example usage:

use aleph_alpha_api::{error::ApiError, Client, CompletionRequest, LUMINOUS_BASE};

const AA_API_TOKEN: &str = "<YOUR_AA_API_TOKEN>";

async fn print_completion() -> Result<(), ApiError> {
   let client = Client::new(AA_API_TOKEN.to_owned())?;

   let request =
       CompletionRequest::from_text(LUMINOUS_BASE.to_owned(), "An apple a day".to_owned(), 10)
           .temperature(0.8)
           .top_k(50)
           .top_p(0.95)
           .best_of(2)
           .minimum_tokens(2);

   let response = client.completion(&request, Some(true)).await?;

   println!("An apple a day{}", response.best_text());

   Ok(())
}

Modules§

error
http
image_processing

Macros§

impl_builder_methods

Structs§

BatchSemanticEmbeddingRequest
BatchSemanticEmbeddingResponse
BoundingBox
Bounding box in logical coordinates. From 0 to 1. With (0,0) being the upper left corner, and relative to the entire image.
Client
CompletionOutput
CompletionRequest
CompletionResponse
DetokenizationRequest
DetokenizationResponse
EmbeddingRequest
EmbeddingResponse
EvaluationRequest
EvaluationResponse
EvaluationResult
ExplanationItem
ExplanationRequest
ExplanationResponse
The top-level response data structure that will be returned from an explanation request.
ImageControl
Prompt
PromptGranularity
ScoredRect
ScoredSegment
SemanticEmbeddingRequest
Embeds a prompt using a specific model and semantic embedding method. Resulting vectors that can be used for downstream tasks (e.g. semantic similarity) and models (e.g. classifiers).
SemanticEmbeddingResponse
TextControl
TokenControl
TokenizationRequest
TokenizationResponse

Enums§

ControlTokenOverlap
EmbeddingRepresentation
Type of embedding representation to embed the prompt with.
Hosting
Optional parameter that specifies which datacenters may process the request. You can either set the parameter to “aleph-alpha” or omit it (defaulting to null).
ItemImportance
Modality
The prompt for models can be a combination of different modalities (Text and Image). The type of modalities which are supported depend on the Model in question.
Postprocessing
PromptGranularityType
TargetGranularity
How many explanations should be returned in the output.

Constants§

ALEPH_ALPHA_API_BASE_URL
LUMINOUS_BASE
LUMINOUS_BASE_CONTROL
LUMINOUS_EXTENDED
LUMINOUS_EXTENDED_CONTROL
LUMINOUS_SUPREME
LUMINOUS_SUPREME_CONTROL