Crates.io | ai-chain-glm |
lib.rs | ai-chain-glm |
version | 0.14.2 |
source | src |
created_at | 2024-05-21 14:35:22.374574 |
updated_at | 2024-05-22 15:32:24.13175 |
description | A library implementing `ai-chains` for moonshot OpenAI's models. Chains can be use to apply the model series to complete complex tasks, such as text summation. |
homepage | |
repository | https://github.com/godlinchong/ai-chain |
max_upload_size | |
id | 1246893 |
size | 162,537 |
ai-chain fork llm-chain with extensions
ai-chain
is a collection of Rust crates designed to help you create advanced LLM applications such as chatbots, agents, and more. As a comprehensive LLM-Ops platform we have strong support for both cloud and locally-hosted LLMs. We also provide robust support for prompt templates and chaining together prompts in multi-step chains, enabling complex tasks that LLMs can't handle in a single step. We also provide vector store integrations making it easy to give your model long-term memory and subject matter knowledge. This empowers you to build sophisticated applications.
improve openai-compatible api
add glm llm
upgrade moonshot llm
To help you get started, here is an example demonstrating how to use ai-chain
. You can find more examples in the examples folder in the repository.
let exec = executor!()?;
let res = prompt!(
"You are a robot assistant for making personalized greetings",
"Make a personalized greeting for Joe"
)
.run(parameters()!, &exec)
.await?;
println!("{}", res);
➡️ tutorial: get started with ai-chain ➡️ quick-start: Create project based on our template
llm.rs
support: Use llms in rust without dependencies on C++ code with our support for llm.rs
ai-chain
.To start using ai-chain
, add it as a dependency in your Cargo.toml
(you need Rust 1.65.0 or newer):
ai-chain-openai
[dependencies]
ai-chain = "0.14.2"
ai-chain-openai = "0.14.2"
env::set_var("OPENAI_API_KEY", "sk-7LVW4lfKX3ZL01Iwuz8H0oZsUaLsEuO7ri9bfRKV36NrTE1A");
let exec = executor!()?;
let res = prompt!(
"You are a robot assistant for making personalized greetings",
"Make a personalized greeting for Joe"
)
.run(parameters()!, &exec)
.await?;
println!("{}", res);
ai-chain-moonshot
[dependencies]
ai-chain = "0.14.2"
ai-chain-moonshot = "0.14.2"
env::set_var("OPENAI_API_KEY", "sk-7LVW4lfKX3ZL01Iwuz8H0oZsUaLsEuO7ri9bfRKV36NrTE1A");
let exec = executor!(mooonshot)?;
let res = prompt!(
"You are a robot assistant for making personalized greetings",
"Make a personalized greeting for Joe"
)
.run(parameters()!, &exec)
.await?;
println!("{}", res);
ai-chain-glm
[dependencies]
ai-chain = "0.14.2"
ai-chain-glm = "0.14.2"
env::set_var("OPENAI_API_KEY", "sk-7LVW4lfKX3ZL01Iwuz8H0oZsUaLsEuO7ri9bfRKV36NrTE1A");
let exec = executor!(glm)?;
let res = prompt!(
"You are a robot assistant for making personalized greetings",
"Make a personalized greeting for Joe"
)
.run(parameters()!, &exec)
.await?;
println!("{}", res);
ai-chain-qwen
[dependencies]
ai-chain = "0.14.2"
ai-chain-qwen = "0.14.2"
env::set_var("OPENAI_API_KEY", "sk-7LVW4lfKX3ZL01Iwuz8H0oZsUaLsEuO7ri9bfRKV36NrTE1A");
let exec = executor!(qwen)?;
let res = prompt!(
"You are a robot assistant for making personalized greetings",
"Make a personalized greeting for Joe"
)
.run(parameters()!, &exec)
.await?;
println!("{}", res);
The examples for `ai-chain-openai` or `ai-chain-moonshot` or others llms require you to set the `OPENAI_API_KEY` environment variable which you can do like this:
```bash
export OPENAI_API_KEY="sk-YOUR_OPEN_AI_KEY_HERE"
env::set_var("OPENAI_API_KEY", "sk-7LVW4lfKX3ZL01Iwuz8H0oZsUaLsEuO7ri9bfRKV36NrTE1A");
let exec = executor!(costume,ai_chain_qwen)?;
let res = prompt!(
"You are a robot assistant for making personalized greetings",
"Make a personalized greeting for Joe"
)
.run(parameters()!, &exec)
.await?;
println!("{}", res);
The examples for `ai-chain-openai` or `ai-chain-moonshot` or others llms require you to set the `OPENAI_API_KEY` environment variable which you can do like this:
```bash
export OPENAI_API_KEY="sk-YOUR_OPEN_AI_KEY_HERE"
We warmly welcome contributions from everyone! If you're interested in helping improve ai-chain
, please check out our CONTRIBUTING.md
file for guidelines and best practices.
ai-chain
is licensed under the MIT License.