Skip to main content

PromptConfiguration

Struct PromptConfiguration 

Source
pub struct PromptConfiguration {
Show 31 fields pub respect_robots_txt: Option<bool>, pub subdomains: Option<bool>, pub tld: Option<bool>, pub depth: Option<usize>, pub delay: Option<u64>, pub request_timeout_ms: Option<u64>, pub crawl_timeout_ms: Option<u64>, pub blacklist_url: Option<Vec<String>>, pub whitelist_url: Option<Vec<String>>, pub external_domains: Option<Vec<String>>, pub user_agent: Option<String>, pub headers: Option<HashMap<String, String>>, pub http2_prior_knowledge: Option<bool>, pub accept_invalid_certs: Option<bool>, pub proxies: Option<Vec<String>>, pub redirect_limit: Option<usize>, pub budget: Option<HashMap<String, u32>>, pub max_page_bytes: Option<f64>, pub full_resources: Option<bool>, pub only_html: Option<bool>, pub return_page_links: Option<bool>, pub use_chrome: Option<bool>, pub stealth_mode: Option<String>, pub viewport_width: Option<u32>, pub viewport_height: Option<u32>, pub wait_for_idle_network: Option<bool>, pub wait_for_delay_ms: Option<u64>, pub wait_for_selector: Option<String>, pub evaluate_on_new_document: Option<String>, pub shared_queue: Option<bool>, pub retry: Option<u8>,
}
Expand description

Configuration response from the LLM for prompt-based crawler setup.

This type is specific to spider’s Website configuration. Use it with configure_crawler_from_prompt to generate crawler settings from natural language descriptions.

§Example

use spider::features::automation::configure_crawler_from_prompt;

let config = configure_crawler_from_prompt(
    "http://localhost:11434/v1/chat/completions",
    "llama3",
    None,
    "Crawl only blog posts, max 50 pages, respect robots.txt"
).await?;

// Apply to website
website.apply_prompt_configuration(&config);

Fields§

§respect_robots_txt: Option<bool>

Respect robots.txt rules.

§subdomains: Option<bool>

Crawl subdomains.

§tld: Option<bool>

Crawl top-level domain variants.

§depth: Option<usize>

Maximum crawl depth.

§delay: Option<u64>

Delay between requests in milliseconds.

§request_timeout_ms: Option<u64>

Request timeout in milliseconds.

§crawl_timeout_ms: Option<u64>

Total crawl timeout in milliseconds.

§blacklist_url: Option<Vec<String>>

URL patterns to exclude.

§whitelist_url: Option<Vec<String>>

URL patterns to include exclusively.

§external_domains: Option<Vec<String>>

External domains to allow crawling.

§user_agent: Option<String>

User agent string.

§headers: Option<HashMap<String, String>>

Custom HTTP headers.

§http2_prior_knowledge: Option<bool>

Use HTTP/2 prior knowledge.

§accept_invalid_certs: Option<bool>

Accept invalid SSL certificates.

§proxies: Option<Vec<String>>

Proxy URLs for requests.

§redirect_limit: Option<usize>

Maximum redirect limit.

§budget: Option<HashMap<String, u32>>

Budget limits per path or domain.

§max_page_bytes: Option<f64>

Maximum bytes per page.

§full_resources: Option<bool>

Crawl all resources including assets.

§only_html: Option<bool>

Only crawl HTML pages.

§return_page_links: Option<bool>

Return discovered links with pages.

§use_chrome: Option<bool>

Use headless Chrome for rendering.

§stealth_mode: Option<String>

Stealth mode level: “none”, “basic”, “low”, “mid”, “full”.

§viewport_width: Option<u32>

Browser viewport width.

§viewport_height: Option<u32>

Browser viewport height.

§wait_for_idle_network: Option<bool>

Wait for network to be idle.

§wait_for_delay_ms: Option<u64>

Delay after page load in milliseconds.

§wait_for_selector: Option<String>

CSS selector to wait for.

§evaluate_on_new_document: Option<String>

JavaScript to inject on each page.

§shared_queue: Option<bool>

Use shared queue for even distribution.

§retry: Option<u8>

Retry attempts for failed requests.

Trait Implementations§

Source§

impl Clone for PromptConfiguration

Source§

fn clone(&self) -> PromptConfiguration

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PromptConfiguration

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PromptConfiguration

Source§

fn default() -> PromptConfiguration

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more