style: some cleanup (#33857)

This commit is contained in:
Mason Daugherty
2025-11-06 23:50:46 -05:00
committed by GitHub
parent d40e340479
commit e023201d42
79 changed files with 662 additions and 531 deletions

View File

@@ -306,16 +306,22 @@ class ChatFireworks(BaseChatModel):
"""Return whether this model can be serialized by LangChain."""
return True
client: Any = Field(default=None, exclude=True) #: :meta private:
async_client: Any = Field(default=None, exclude=True) #: :meta private:
client: Any = Field(default=None, exclude=True)
async_client: Any = Field(default=None, exclude=True)
model_name: str = Field(alias="model")
"""Model name to use."""
temperature: float | None = None
"""What sampling temperature to use."""
stop: str | list[str] | None = Field(default=None, alias="stop_sequences")
"""Default stop sequences."""
model_kwargs: dict[str, Any] = Field(default_factory=dict)
"""Holds any model parameters valid for `create` call not explicitly specified."""
fireworks_api_key: SecretStr = Field(
alias="api_key",
default_factory=secret_from_env(
@@ -336,18 +342,25 @@ class ChatFireworks(BaseChatModel):
alias="base_url", default_factory=from_env("FIREWORKS_API_BASE", default=None)
)
"""Base URL path for API requests, leave blank if not using a proxy or service
emulator."""
emulator.
"""
request_timeout: float | tuple[float, float] | Any | None = Field(
default=None, alias="timeout"
)
"""Timeout for requests to Fireworks completion API. Can be `float`,
`httpx.Timeout` or `None`."""
`httpx.Timeout` or `None`.
"""
streaming: bool = False
"""Whether to stream the results or not."""
n: int = 1
"""Number of chat completions to generate for each prompt."""
max_tokens: int | None = None
"""Maximum number of tokens to generate."""
max_retries: int | None = None
"""Maximum number of retries to make when generating."""
@@ -685,10 +698,10 @@ class ChatFireworks(BaseChatModel):
Args:
schema: The output schema. Can be passed in as:
- an OpenAI function/tool schema,
- a JSON Schema,
- a `TypedDict` class,
- or a Pydantic class.
- An OpenAI function/tool schema,
- A JSON Schema,
- A `TypedDict` class,
- Or a Pydantic class.
If `schema` is a Pydantic class then the model output will be a
Pydantic instance of that class, and the model-generated fields will be
@@ -712,11 +725,15 @@ class ChatFireworks(BaseChatModel):
Added support for `'json_schema'`.
include_raw:
If `False` then only the parsed structured output is returned. If
an error occurs during model output parsing it will be raised. If `True`
then both the raw model response (a `BaseMessage`) and the parsed model
response will be returned. If an error occurs during output parsing it
will be caught and returned as well.
If `False` then only the parsed structured output is returned.
If an error occurs during model output parsing it will be raised.
If `True` then both the raw model response (a `BaseMessage`) and the
parsed model response will be returned.
If an error occurs during output parsing it will be caught and returned
as well.
The final output is always a `dict` with keys `'raw'`, `'parsed'`, and
`'parsing_error'`.

View File

@@ -65,7 +65,8 @@ class FireworksEmbeddings(BaseModel, Embeddings):
```
"""
client: OpenAI = Field(default=None, exclude=True) # type: ignore[assignment] # :meta private:
client: OpenAI = Field(default=None, exclude=True) # type: ignore[assignment]
fireworks_api_key: SecretStr = Field(
alias="api_key",
default_factory=secret_from_env(
@@ -77,6 +78,7 @@ class FireworksEmbeddings(BaseModel, Embeddings):
Automatically read from env variable `FIREWORKS_API_KEY` if not provided.
"""
model: str = "nomic-ai/nomic-embed-text-v1.5"
model_config = ConfigDict(