rust-ai

Crates.iorust-ai
lib.rsrust-ai
version0.1.22
sourcesrc
created_at2023-03-22 09:05:38.501869
updated_at2024-02-22 00:13:43.269227
descriptionA collection of 3rd-party AI APIs for Rust
homepagehttps://github.com/dongsxyz/rust-ai/
repositoryhttps://github.com/dongsxyz/rust-ai/
max_upload_size
id816832
size397,626
Zhongdong Yang (zhongdongy)

documentation

https://docs.rs/rust-ai

README

AI in Rust

Provide a collection of third-party APIs that give public access to AI capabilities.

WARNING: this crate is NOT PRODUCTION ready.

Support List

OpenAI

Category Variant Tested Models Stream
Chat completions - gpt-4-turbo-preview, gpt-4-0125-preview, gpt-4-1106-vision-preview, gpt-4-1106-preview, gpt-4-vision-preview, gpt-4, gpt-4-0314, gpt-4-0613, gpt-3.5-turbo-0125, gpt-3.5-turbo-1106, gpt-3.5-turbo, gpt-3.5-turbo-16k, gpt-3.5-turbo-16k-0613, gpt-3.5-turbo-0613, gpt-3.5-turbo-0301, text-davinci-003, text-davinci-002, code-davinci-0021 yes
Completions - gpt-4-turbo-preview, gpt-4-0125-preview, gpt-4-1106-vision-preview, gpt-4-1106-preview, gpt-4-vision-preview, gpt-4, gpt-4-0314, gpt-4-0613, gpt-3.5-turbo-0125, gpt-3.5-turbo-1106, gpt-3.5-turbo, gpt-3.5-turbo-16k, gpt-3.5-turbo-16k-0613, gpt-3.5-turbo-0613, gpt-3.5-turbo-0301, text-davinci-003 yes
Edits - text-davinci-edit-001, code-davinci-edit-001 -
Images Generations dall-e-2, dall-e-3 -
Images Edits dall-e-2 -
Images Variations dall-e-2 -
Embeddings - text-embedding-ada-0022 -
Audios Transcriptions whisper-1 -
Audios Translation whisper-1 -
Moderation - text-moderation-latest3, text-moderation-stable -

Note:

  • Updated on Feburary 22nd, 2024.
  • OpenAI's Fine Tunes endpoints are currently not supported.
  • OpenAI's Assistants endpoints are currently not supported.

Azure

Category Capability Endpoint
Cognitive service Speech Text-to-Speech, Voice-List, Speech-to-Text (Batch)

Note:

  • Azure CN is not supported by this repo yet.

Usage

Create a config.yml in your working directory, or root of this crate. Contents like this:

openai:
  api_key: sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  org_id: org-xxx
  base_endpoint: https://api.openai.com
azure:
  speech:
    key: 4c7eXXXXXXXXXXXXXXXXXXXXXXX54c32
    region: westus

If you prefer to load configuration from environment variables, set the contents to RUST_AI_CONFIG like example chat-completion-streamed does.

Footnotes

  1. GPT-4/GPT-4-0314/GPT-4-0613 tested, GPT-4-32K/GPT-4-32K-0314 not tested because developer currently only has access to 8K token ones (May 6th, 2023).

  2. You may notice the actual model behind Embedding API to be text-embedding-ada-002-v2 (March 23rd, 2023).

  3. OpenAI's responses for moderation indicate usage of text-moderation-004 model (March 23rd, 2023). But developers cannot use its API endpoints to specify variants other than text-moderation-latest and text-moderation-stable.

Commit count: 56

cargo fmt