MCPcopy Index your code
hub / github.com/InfinitiBit/graphbit / new

Method new

core/src/embeddings.rs:211–226  ·  view source on GitHub ↗

Create a new `OpenAI` embedding provider

(config: EmbeddingConfig)

Source from the content-addressed store, hash-verified

209impl OpenAIEmbeddingProvider {
210 /// Create a new `OpenAI` embedding provider
211 pub fn new(config: EmbeddingConfig) -> GraphBitResult<Self> {
212 if config.provider != EmbeddingProvider::OpenAI {
213 return Err(GraphBitError::config(
214 "Invalid provider type for OpenAI".to_string(),
215 ));
216 }
217
218 let client = reqwest::Client::builder()
219 .timeout(std::time::Duration::from_secs(
220 config.timeout_seconds.unwrap_or(30),
221 ))
222 .build()
223 .map_err(|e| GraphBitError::llm(format!("Failed to create HTTP client: {e}")))?;
224
225 Ok(Self { config, client })
226 }
227
228 /// Get the API base URL
229 fn base_url(&self) -> &str {

Callers

nothing calls this directly

Calls 4

to_stringMethod · 0.80
cloneMethod · 0.80
buildMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected