Categorygithub.com/ztkent/ai-util
repositorypackage
0.7.2
Repository: https://github.com/ztkent/ai-util.git
Documentation: pkg.go.dev

# README

AI Util

A unified platform to build apps with AI.

Features

  • Supported AI Providers:
  • Conversation Controls
  • Token Management + Limits
  • Resource Management

Installation

go get github.com/ztkent/ai-util

Example

    client, _ := aiutil.NewAIClient("openai", "gpt-3.5-turbo", 0.5)
    conversation := aiutil.NewConversation("You are an example assistant.", 100000, true)
    response, _ := client.SendCompletionRequest(CtxWithTimeout, conversation, "Say hello!")

Required API Keys

ServiceEnvironment Variable
OpenAIOPENAI_API_KEY
ReplicateREPLICATE_API_TOKEN

Available Models

OpenAI Models

Model NameModel IdentifierCost (IN/OUT per 1M tokens)
GPT-3.5 Turbogpt-3.5-turbo$0.50 / $1.50
GPT-4gpt-4$30.00 / $60.00
GPT-4 Turbogpt-4-turbo$10.00 / $30.00

Replicate Models

Model NameModel IdentifierCost (IN/OUT per 1M tokens)
Meta Llama 2-70bmeta/llama-2-70b$0.65 / $2.75
Meta Llama 2-13bmeta/llama-2-13b$0.10 / $0.50
Meta Llama 2-7bmeta/llama-2-7b$0.05 / $0.25
Meta Llama 2-13b Chatmeta/llama-2-13b-chat$0.10 / $0.50
Meta Llama 2-70b Chatmeta/llama-2-70b-chat$0.65 / $2.75
Meta Llama 2-7b Chatmeta/llama-2-7b-chat$0.05 / $0.25
Meta Llama 3-8bmeta/meta-llama-3-8b$0.05 / $0.25
Meta Llama 3-70bmeta/meta-llama-3-70b$0.65 / $2.75
Meta Llama 3-8b Instructmeta/meta-llama-3-8b-instruct$0.05 / $0.25
Meta Llama 3-70b Instructmeta/meta-llama-3-70b-instruct$0.65 / $2.75
Mistral 7Bmistralai/mistral-7b-v0.1$0.05 / $0.25
Mistral 7B Instructmistralai/mistral-7b-instruct-v0.2$0.05 / $0.25
Mixtral 8x7B Instructmistralai/mixtral-8x7b-instruct-v0.1$0.30 / $1.00