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 rt-multi-thread )。
您可以找到更多示例每個板條箱的examples (即src/examples )目錄。更詳細的用例演練定期在我們的Dev.to博客上發布。
| 模型提供商 | 向量存儲 |
|---|---|