scrapegraphai.models package¶
Submodules¶
scrapegraphai.models.deepseek module¶
DeepSeek Module
- class scrapegraphai.models.deepseek.DeepSeek(*, name: ~typing.Optional[str] = None, cache: ~typing.Optional[~typing.Union[~langchain_core.caches.BaseCache, bool]] = None, verbose: bool = <factory>, callbacks: ~typing.Optional[~typing.Union[list[langchain_core.callbacks.base.BaseCallbackHandler], ~langchain_core.callbacks.base.BaseCallbackManager]] = None, tags: ~typing.Optional[list[str]] = None, metadata: ~typing.Optional[dict[str, typing.Any]] = None, custom_get_token_ids: ~typing.Optional[~typing.Callable[[str], list[int]]] = None, callback_manager: ~typing.Optional[~langchain_core.callbacks.base.BaseCallbackManager] = None, rate_limiter: ~typing.Optional[~langchain_core.rate_limiters.BaseRateLimiter] = None, disable_streaming: ~typing.Union[bool, ~typing.Literal['tool_calling']] = False, client: ~typing.Any = None, async_client: ~typing.Any = None, root_client: ~typing.Any = None, root_async_client: ~typing.Any = None, model: str = 'gpt-3.5-turbo', temperature: float = 0.7, model_kwargs: ~typing.Dict[str, ~typing.Any] = <factory>, api_key: ~typing.Optional[~pydantic.types.SecretStr] = <factory>, base_url: ~typing.Optional[str] = None, organization: ~typing.Optional[str] = None, openai_proxy: ~typing.Optional[str] = <factory>, timeout: ~typing.Optional[~typing.Union[float, ~typing.Tuple[float, float], ~typing.Any]] = None, max_retries: int = 2, presence_penalty: ~typing.Optional[float] = None, frequency_penalty: ~typing.Optional[float] = None, seed: ~typing.Optional[int] = None, logprobs: ~typing.Optional[bool] = None, top_logprobs: ~typing.Optional[int] = None, logit_bias: ~typing.Optional[~typing.Dict[int, int]] = None, streaming: bool = False, n: int = 1, top_p: ~typing.Optional[float] = None, max_completion_tokens: ~typing.Optional[int] = None, reasoning_effort: ~typing.Optional[str] = None, tiktoken_model_name: ~typing.Optional[str] = None, default_headers: ~typing.Optional[~typing.Mapping[str, str]] = None, default_query: ~typing.Optional[~typing.Mapping[str, object]] = None, http_client: ~typing.Optional[~typing.Any] = None, http_async_client: ~typing.Optional[~typing.Any] = None, stop_sequences: ~typing.Optional[~typing.Union[~typing.List[str], str]] = None, extra_body: ~typing.Optional[~typing.Mapping[str, ~typing.Any]] = None, include_response_headers: bool = False, disabled_params: ~typing.Optional[~typing.Dict[str, ~typing.Any]] = None, stream_usage: bool = False)¶
Bases:
ChatOpenAI
A wrapper for the ChatOpenAI class (DeepSeek uses an OpenAI-like API) that provides default configuration and could be extended with additional methods if needed.
- Parameters:
llm_config (dict) – Configuration parameters for the language model.
- max_tokens: Optional[int]¶
Maximum number of tokens to generate.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'ignore', 'populate_by_name': True, 'protected_namespaces': ()}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- stream_usage: bool¶
Whether to include usage metadata in streaming output. If True, additional message chunks will be generated during the stream including usage metadata.
scrapegraphai.models.oneapi module¶
OneAPI Module
- class scrapegraphai.models.oneapi.OneApi(*, name: ~typing.Optional[str] = None, cache: ~typing.Optional[~typing.Union[~langchain_core.caches.BaseCache, bool]] = None, verbose: bool = <factory>, callbacks: ~typing.Optional[~typing.Union[list[langchain_core.callbacks.base.BaseCallbackHandler], ~langchain_core.callbacks.base.BaseCallbackManager]] = None, tags: ~typing.Optional[list[str]] = None, metadata: ~typing.Optional[dict[str, typing.Any]] = None, custom_get_token_ids: ~typing.Optional[~typing.Callable[[str], list[int]]] = None, callback_manager: ~typing.Optional[~langchain_core.callbacks.base.BaseCallbackManager] = None, rate_limiter: ~typing.Optional[~langchain_core.rate_limiters.BaseRateLimiter] = None, disable_streaming: ~typing.Union[bool, ~typing.Literal['tool_calling']] = False, client: ~typing.Any = None, async_client: ~typing.Any = None, root_client: ~typing.Any = None, root_async_client: ~typing.Any = None, model: str = 'gpt-3.5-turbo', temperature: float = 0.7, model_kwargs: ~typing.Dict[str, ~typing.Any] = <factory>, api_key: ~typing.Optional[~pydantic.types.SecretStr] = <factory>, base_url: ~typing.Optional[str] = None, organization: ~typing.Optional[str] = None, openai_proxy: ~typing.Optional[str] = <factory>, timeout: ~typing.Optional[~typing.Union[float, ~typing.Tuple[float, float], ~typing.Any]] = None, max_retries: int = 2, presence_penalty: ~typing.Optional[float] = None, frequency_penalty: ~typing.Optional[float] = None, seed: ~typing.Optional[int] = None, logprobs: ~typing.Optional[bool] = None, top_logprobs: ~typing.Optional[int] = None, logit_bias: ~typing.Optional[~typing.Dict[int, int]] = None, streaming: bool = False, n: int = 1, top_p: ~typing.Optional[float] = None, max_completion_tokens: ~typing.Optional[int] = None, reasoning_effort: ~typing.Optional[str] = None, tiktoken_model_name: ~typing.Optional[str] = None, default_headers: ~typing.Optional[~typing.Mapping[str, str]] = None, default_query: ~typing.Optional[~typing.Mapping[str, object]] = None, http_client: ~typing.Optional[~typing.Any] = None, http_async_client: ~typing.Optional[~typing.Any] = None, stop_sequences: ~typing.Optional[~typing.Union[~typing.List[str], str]] = None, extra_body: ~typing.Optional[~typing.Mapping[str, ~typing.Any]] = None, include_response_headers: bool = False, disabled_params: ~typing.Optional[~typing.Dict[str, ~typing.Any]] = None, stream_usage: bool = False)¶
Bases:
ChatOpenAI
A wrapper for the OneApi class that provides default configuration and could be extended with additional methods if needed.
- Parameters:
llm_config (dict) – Configuration parameters for the language model.
- max_tokens: Optional[int]¶
Maximum number of tokens to generate.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'ignore', 'populate_by_name': True, 'protected_namespaces': ()}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- stream_usage: bool¶
Whether to include usage metadata in streaming output. If True, additional message chunks will be generated during the stream including usage metadata.
scrapegraphai.models.openai_itt module¶
OpenAIImageToText Module
- class scrapegraphai.models.openai_itt.OpenAIImageToText(llm_config: dict)¶
Bases:
ChatOpenAI
A wrapper for the OpenAIImageToText class that provides default configuration and could be extended with additional methods if needed.
- Parameters:
llm_config (dict) – Configuration parameters for the language model.
max_tokens (int) – The maximum number of tokens to generate.
- max_tokens: Optional[int]¶
Maximum number of tokens to generate.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'ignore', 'populate_by_name': True, 'protected_namespaces': ()}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- run(image_url: str) str ¶
Runs the image-to-text conversion using the provided image URL.
- Parameters:
image_url (str) – The URL of the image to convert.
- Returns:
The text description of the image.
- Return type:
str
- stream_usage: bool¶
Whether to include usage metadata in streaming output. If True, additional message chunks will be generated during the stream including usage metadata.
scrapegraphai.models.openai_tts module¶
OpenAITextToSpeech Module
- class scrapegraphai.models.openai_tts.OpenAITextToSpeech(tts_config: dict)¶
Bases:
object
Implements a text-to-speech model using the OpenAI API.
- client¶
The OpenAI client used to interact with the API.
- Type:
OpenAI
- model¶
The model to use for text-to-speech conversion.
- Type:
str
- voice¶
The voice model to use for generating speech.
- Type:
str
- Parameters:
tts_config (dict) – Configuration parameters for the text-to-speech model.
- run(text: str) bytes ¶
Converts the provided text to speech and returns the bytes of the generated speech.
- Parameters:
text (str) – The text to convert to speech.
- Returns:
The bytes of the generated speech audio.
- Return type:
bytes
Module contents¶
This module contains the model definitions used in the ScrapeGraphAI application.