feat: Build a prototype FFI for goose rust library (#2206)
This builds a prototype FFI for goose rust library which only supports initializing goose agent and sending message, there is no support for tool calling yet in this library.
This commit is contained in:
@@ -84,7 +84,6 @@ impl DatabricksProvider {
|
||||
// For compatibility for now we check both config and secret for databricks host
|
||||
// but it is not actually a secret value
|
||||
let mut host: Result<String, ConfigError> = config.get_param("DATABRICKS_HOST");
|
||||
|
||||
if host.is_err() {
|
||||
host = config.get_secret("DATABRICKS_HOST")
|
||||
}
|
||||
@@ -123,6 +122,31 @@ impl DatabricksProvider {
|
||||
})
|
||||
}
|
||||
|
||||
/// Create a new DatabricksProvider with the specified host and token
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `host` - The Databricks host URL
|
||||
/// * `token` - The Databricks API token
|
||||
/// * `model` - The model configuration
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// Returns a Result containing the new DatabricksProvider instance
|
||||
pub fn from_params(host: String, api_key: String, model: ModelConfig) -> Result<Self> {
|
||||
let client = Client::builder()
|
||||
.timeout(Duration::from_secs(600))
|
||||
.build()?;
|
||||
|
||||
Ok(Self {
|
||||
client,
|
||||
host,
|
||||
auth: DatabricksAuth::token(api_key),
|
||||
model,
|
||||
image_format: ImageFormat::OpenAi,
|
||||
})
|
||||
}
|
||||
|
||||
async fn ensure_auth_header(&self) -> Result<String> {
|
||||
match &self.auth {
|
||||
DatabricksAuth::Token(token) => Ok(format!("Bearer {}", token)),
|
||||
|
||||
Reference in New Issue
Block a user