TGViewer
Rust Rust @rust_code · 8.92K subscribers
Post #846 3.54K
🦀 Инструмент разработки портативных, модульных и легких Fullstack агентов

cargo add rig-core


rust 
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}");
}

★ 2378

🖥 Github

@rust_code
  • ❤ 15
  • 🔥 9
  • 👍 7
  • 🥰 1
  • 🍓 1
More from @rust_code
  1. Sep 28, 2026🦀 Qt открывает Rust полноценный путь к кроссплатформенному UI Qt представила Qt Bridge fo…
  2. Sep 26, 2026Как создать пустой vector по-гениальному
  3. Sep 24, 2026🦀 Как доказать, что Rust-код работает правильно: Amazon рассказывает о Verus Rust предотв…
  4. Sep 24, 2026❌В IT сейчас кризис джунов, но только не в кибербезе. ❗️Рынку не хватает 50 000 специалист…
  5. Sep 24, 2026Rust без аллокатора: `fff` снизил пиковое потребление памяти через `mmap` Во время тестиро…
  6. Sep 23, 2026photo post
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →