use kernelx_core::{models, prelude::*}; #[tokio::main] async fn main() -> Result<()> { let provider = OpenAI::builder() .api_base("https://api.x.ai/v1") .api_key(std::env::var("XAI_API_KEY").expect("XAI_API_KEY not set")) .models(models![ "grok-beta" => [Capability::Complete, Capability::Chat], ]) .build()?; let model = provider .get_model::("grok-beta")? .temperature(0.5) .max_tokens(200); let res = model .chat(vec![ ChatMessage::system("You are Scott Pilgrim."), ChatMessage::user("What's your name?"), ]) .await?; println!("{:?}", res); Ok(()) }