pub struct LlmWeb { /* private fields */ }Expand description
The main client. Holds an async-openai client and the model name.
Implementations§
Source§impl LlmWeb
impl LlmWeb
Sourcepub fn new(name: &str) -> Self
pub fn new(name: &str) -> Self
Create a client using the default config — reads the API key from
the OPENAI_API_KEY env var and hits the official OpenAI endpoint.
For any other provider (DeepSeek, Groq, z.ai, OpenRouter, Ollama, …)
use Self::with_client.
Sourcepub fn with_client(client: Client<OpenAIConfig>, model: &str) -> Self
pub fn with_client(client: Client<OpenAIConfig>, model: &str) -> Self
Create a client with a pre-built async_openai::Client. Use this to
point at a custom endpoint, supply an inline API key, etc. Build the
underlying client with OpenAIConfig::new().with_api_base(...).with_api_key(...).
pub async fn exec<R>(&self, url: &str, scheme: Value) -> Result<R>where
R: DeserializeOwned + Debug,
pub async fn exec_with<R>(
&self,
url: &str,
scheme: Value,
opts: RunOptions,
) -> Result<R>where
R: DeserializeOwned + Debug,
pub async fn exec_from_schema_str<R>(
&self,
url: &str,
schema_str: &str,
) -> Result<R>where
R: DeserializeOwned + Debug,
pub async fn stream<R>( &self, url: &str, scheme: Value, ) -> Result<PartialStream<R>>
pub async fn stream_with<R>( &self, url: &str, scheme: Value, opts: RunOptions, ) -> Result<PartialStream<R>>
pub async fn generate(&self, url: &str, scheme: Value) -> Result<String>
pub async fn generate_with( &self, url: &str, scheme: Value, opts: RunOptions, ) -> Result<String>
pub async fn run_script<R>(&self, url: &str, js: &str) -> Result<R>where
R: DeserializeOwned + Debug,
pub async fn generate_recipe( &self, url: &str, scheme: Value, ) -> Result<ExtractRecipe>
pub async fn generate_recipe_with( &self, url: &str, scheme: Value, opts: RunOptions, ) -> Result<ExtractRecipe>
pub async fn run_recipe<R>(
&self,
url: &str,
recipe: &ExtractRecipe,
) -> Result<R>where
R: DeserializeOwned + Debug,
pub async fn exec_on_tab<R>(
&self,
tab: &Arc<Tab>,
scheme: Value,
opts: RunOptions,
) -> Result<R>where
R: DeserializeOwned + Debug,
pub async fn stream_on_tab<R>( &self, tab: &Arc<Tab>, scheme: Value, opts: RunOptions, ) -> Result<PartialStream<R>>
pub async fn generate_on_tab( &self, tab: &Arc<Tab>, scheme: Value, opts: RunOptions, ) -> Result<String>
pub async fn generate_recipe_on_tab( &self, tab: &Arc<Tab>, scheme: Value, opts: RunOptions, ) -> Result<ExtractRecipe>
pub async fn exec_on_html<R>(
&self,
html: &str,
scheme: Value,
opts: RunOptions,
) -> Result<R>where
R: DeserializeOwned + Debug,
pub async fn stream_on_html<R>( &self, html: &str, scheme: Value, opts: RunOptions, ) -> Result<PartialStream<R>>
pub async fn generate_recipe_on_html( &self, html: &str, scheme: Value, opts: RunOptions, ) -> Result<ExtractRecipe>
Auto Trait Implementations§
impl Freeze for LlmWeb
impl !RefUnwindSafe for LlmWeb
impl Send for LlmWeb
impl Sync for LlmWeb
impl Unpin for LlmWeb
impl UnsafeUnpin for LlmWeb
impl !UnwindSafe for LlmWeb
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more