rig
ve-v0.1.0
如果您想帮助传播有关钻机的信息,请考虑主演仓库!
警告
这是龙!钻机是Alpha软件,随着它的发展,它将包含破坏变化。我们会注释它们,并在遇到它们时突出显示迁移路径。
钻机是一个用于构建可扩展,模块化和人体工程学的LLM驱动应用程序的锈库。
有关此板条箱的更多信息可以在板条箱文档中找到。
通过为我们的反馈表做出贡献来帮助我们改善钻机。
cargo add rig-core use rig :: { completion :: Prompt , providers :: openai } ;
# [ tokio :: main ]
async fn main ( ) {
// Create OpenAI client and model
// This requires the `OPENAI_API_KEY` environment variable to be set.
let openai_client = openai :: Client :: from_env ( ) ;
let gpt4 = openai_client . agent ( "gpt-4" ) . build ( ) ;
// Prompt the model and print its response
let response = gpt4
. prompt ( "Who are you?" )
. await
. expect ( "Failed to prompt GPT-4" ) ;
println ! ( "GPT-4: {response}" ) ;
}请注意使用#[tokio::main]需要启用Tokio的macros和rt-multi-thread功能,或者full启用所有功能( cargo add tokio --features macros,rt-multi-thread )。
您可以找到更多示例每个板条箱的examples (即src/examples )目录。更详细的用例演练定期在我们的Dev.to博客上发布。
| 模型提供商 | 向量存储 |
|---|---|