llms.py — langchain Source File
Architecture documentation for llms.py, a python file in the langchain codebase. 10 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR b3a5fe2d_0c8f_117a_8c65_f72e4e7f99eb["llms.py"] 2a7f66a7_8738_3d47_375b_70fcaa6ac169["logging"] b3a5fe2d_0c8f_117a_8c65_f72e4e7f99eb --> 2a7f66a7_8738_3d47_375b_70fcaa6ac169 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] b3a5fe2d_0c8f_117a_8c65_f72e4e7f99eb --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 792c09b7_7372_31d2_e29c_dc98949aa3c2["requests"] b3a5fe2d_0c8f_117a_8c65_f72e4e7f99eb --> 792c09b7_7372_31d2_e29c_dc98949aa3c2 fa1315cb_22bf_b286_79d6_91c271016a4c["aiohttp"] b3a5fe2d_0c8f_117a_8c65_f72e4e7f99eb --> fa1315cb_22bf_b286_79d6_91c271016a4c f3bc7443_c889_119d_0744_aacc3620d8d2["langchain_core.callbacks"] b3a5fe2d_0c8f_117a_8c65_f72e4e7f99eb --> f3bc7443_c889_119d_0744_aacc3620d8d2 89934eed_a823_2184_acf2_039f48eed5f9["langchain_core.language_models.llms"] b3a5fe2d_0c8f_117a_8c65_f72e4e7f99eb --> 89934eed_a823_2184_acf2_039f48eed5f9 f4d905c6_a2b2_eb8f_be9b_7808b72f6a16["langchain_core.utils"] b3a5fe2d_0c8f_117a_8c65_f72e4e7f99eb --> f4d905c6_a2b2_eb8f_be9b_7808b72f6a16 afb01135_7b40_b00b_9769_21eebcc09aa3["langchain_core.utils.utils"] b3a5fe2d_0c8f_117a_8c65_f72e4e7f99eb --> afb01135_7b40_b00b_9769_21eebcc09aa3 6e58aaea_f08e_c099_3cc7_f9567bfb1ae7["pydantic"] b3a5fe2d_0c8f_117a_8c65_f72e4e7f99eb --> 6e58aaea_f08e_c099_3cc7_f9567bfb1ae7 a98b79a9_03ed_db8c_bbe5_757c4a0b6f54["langchain_fireworks.version"] b3a5fe2d_0c8f_117a_8c65_f72e4e7f99eb --> a98b79a9_03ed_db8c_bbe5_757c4a0b6f54 style b3a5fe2d_0c8f_117a_8c65_f72e4e7f99eb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Wrapper around Fireworks AI's Completion API."""
from __future__ import annotations
import logging
from typing import Any
import requests
from aiohttp import ClientSession, ClientTimeout
from langchain_core.callbacks import (
AsyncCallbackManagerForLLMRun,
CallbackManagerForLLMRun,
)
from langchain_core.language_models.llms import LLM
from langchain_core.utils import get_pydantic_field_names
from langchain_core.utils.utils import _build_model_kwargs, secret_from_env
from pydantic import ConfigDict, Field, SecretStr, model_validator
from langchain_fireworks.version import __version__
logger = logging.getLogger(__name__)
class Fireworks(LLM):
"""LLM models from `Fireworks`.
To use, you'll need an [API key](https://fireworks.ai). This can be passed in as
init param `fireworks_api_key` or set as environment variable
`FIREWORKS_API_KEY`.
[Fireworks AI API reference](https://readme.fireworks.ai/)
Example:
```python
response = fireworks.generate(["Tell me a joke."])
```
"""
base_url: str = "https://api.fireworks.ai/inference/v1/completions"
"""Base inference API URL."""
fireworks_api_key: SecretStr = Field(
alias="api_key",
default_factory=secret_from_env(
"FIREWORKS_API_KEY",
error_message=(
"You must specify an api key. "
"You can pass it an argument as `api_key=...` or "
"set the environment variable `FIREWORKS_API_KEY`."
),
),
)
"""Fireworks API key.
Automatically read from env variable `FIREWORKS_API_KEY` if not provided.
"""
model: str
"""Model name. [(Available models)](https://readme.fireworks.ai/)"""
temperature: float | None = None
"""Model temperature."""
top_p: float | None = None
// ... (174 more lines)
Domain
Subdomains
Classes
Dependencies
- aiohttp
- langchain_core.callbacks
- langchain_core.language_models.llms
- langchain_core.utils
- langchain_core.utils.utils
- langchain_fireworks.version
- logging
- pydantic
- requests
- typing
Source
Frequently Asked Questions
What does llms.py do?
llms.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What does llms.py depend on?
llms.py imports 10 module(s): aiohttp, langchain_core.callbacks, langchain_core.language_models.llms, langchain_core.utils, langchain_core.utils.utils, langchain_fireworks.version, logging, pydantic, and 2 more.
Where is llms.py in the architecture?
llms.py is located at libs/partners/fireworks/langchain_fireworks/llms.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/partners/fireworks/langchain_fireworks).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free