Publish harness and TUI open-source
initial sync from the monorepo
This commit is contained in:
commit
c68e39f604
2734 changed files with 1437016 additions and 0 deletions
32
crates/codegen/xai-grok-sampler/tests/support/mod.rs
Normal file
32
crates/codegen/xai-grok-sampler/tests/support/mod.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
//! Sampler-specific helpers for the shared-HTTP-client integration binaries:
|
||||
//! config + request drivers for real `SamplingClient`s. The generic
|
||||
//! connection-counting server lives in `xai_grok_test_support`.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use xai_grok_sampler::{SamplerConfig, SamplingClient};
|
||||
use xai_grok_sampling_types::{ContentPart, ConversationItem, ConversationRequest, UserItem};
|
||||
|
||||
pub fn test_config(base_url: &str, api_key: &str) -> SamplerConfig {
|
||||
SamplerConfig {
|
||||
api_key: Some(api_key.to_string()),
|
||||
base_url: base_url.to_string(),
|
||||
model: "test-model".to_string(),
|
||||
..SamplerConfig::default()
|
||||
}
|
||||
}
|
||||
|
||||
/// Drive one POST through the client; the canned `{}` body is not a valid
|
||||
/// completion, but only the wire-level request matters here.
|
||||
pub async fn send_one(client: &SamplingClient) {
|
||||
let request = ConversationRequest {
|
||||
items: vec![ConversationItem::User(UserItem {
|
||||
content: vec![ContentPart::Text {
|
||||
text: Arc::<str>::from("hi"),
|
||||
}],
|
||||
..Default::default()
|
||||
})],
|
||||
..Default::default()
|
||||
};
|
||||
let _ = client.conversation(request).await;
|
||||
}
|
||||
Loading…
Reference in a new issue