mirror of
https://github.com/aljazceru/goose.git
synced 2026-02-23 07:24:24 +01:00
Add xAI Test Coverage (#3020)
Co-authored-by: Sam Bradbury <Sam Bradbury> Co-authored-by: Sam Bradbury <sam@consultbradbury.com>
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
"models": ["gemini-1.5-flash"],
|
||||
"required_keys": ["GOOGLE_API_KEY"]
|
||||
},
|
||||
"grok": {
|
||||
"groq": {
|
||||
"name": "Groq",
|
||||
"description": "Lorem ipsum",
|
||||
"models": ["llama-3.3-70b-versatile"],
|
||||
@@ -58,5 +58,11 @@
|
||||
"description": "Connect to LLMs via AWS Bedrock",
|
||||
"models": ["us.anthropic.claude-3-7-sonnet-20250219-v1:0"],
|
||||
"required_keys": ["AWS_PROFILE"]
|
||||
}
|
||||
},
|
||||
"xai": {
|
||||
"name": "Xai",
|
||||
"description": "Lorem ipsum",
|
||||
"models": ["grok-3"],
|
||||
"required_keys": ["XAI_API_KEY"]
|
||||
},
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ use goose::providers::{
|
||||
anthropic::AnthropicProvider, azure::AzureProvider, bedrock::BedrockProvider,
|
||||
databricks::DatabricksProvider, gcpvertexai::GcpVertexAIProvider, google::GoogleProvider,
|
||||
groq::GroqProvider, ollama::OllamaProvider, openai::OpenAiProvider,
|
||||
openrouter::OpenRouterProvider,
|
||||
openrouter::OpenRouterProvider, xai::XaiProvider,
|
||||
};
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
@@ -27,6 +27,7 @@ enum ProviderType {
|
||||
Groq,
|
||||
Ollama,
|
||||
OpenRouter,
|
||||
Xai,
|
||||
}
|
||||
|
||||
impl ProviderType {
|
||||
@@ -46,6 +47,7 @@ impl ProviderType {
|
||||
ProviderType::Ollama => &[],
|
||||
ProviderType::OpenRouter => &["OPENROUTER_API_KEY"],
|
||||
ProviderType::GcpVertexAI => &["GCP_PROJECT_ID", "GCP_LOCATION"],
|
||||
ProviderType::Xai => &["XAI_API_KEY"],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +81,7 @@ impl ProviderType {
|
||||
ProviderType::Groq => Arc::new(GroqProvider::from_env(model_config)?),
|
||||
ProviderType::Ollama => Arc::new(OllamaProvider::from_env(model_config)?),
|
||||
ProviderType::OpenRouter => Arc::new(OpenRouterProvider::from_env(model_config)?),
|
||||
ProviderType::Xai => Arc::new(XaiProvider::from_env(model_config)?),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -329,6 +332,16 @@ mod tests {
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_agent_with_xai() -> Result<()> {
|
||||
run_test_with_config(TestConfig {
|
||||
provider_type: ProviderType::Xai,
|
||||
model: "grok-3",
|
||||
context_window: 9_000,
|
||||
})
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -4,7 +4,7 @@ use goose::message::{Message, MessageContent};
|
||||
use goose::providers::base::Provider;
|
||||
use goose::providers::errors::ProviderError;
|
||||
use goose::providers::{
|
||||
anthropic, azure, bedrock, databricks, google, groq, ollama, openai, openrouter, snowflake,
|
||||
anthropic, azure, bedrock, databricks, google, groq, ollama, openai, openrouter, snowflake, xai,
|
||||
};
|
||||
use mcp_core::content::Content;
|
||||
use mcp_core::tool::Tool;
|
||||
@@ -501,6 +501,11 @@ async fn test_sagemaker_tgi_provider() -> Result<()> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_xai_provider() -> Result<()> {
|
||||
test_provider("Xai", &["XAI_API_KEY"], None, xai::XaiProvider::default).await
|
||||
}
|
||||
|
||||
// Print the final test report
|
||||
#[ctor::dtor]
|
||||
fn print_test_report() {
|
||||
|
||||
Reference in New Issue
Block a user