__init__.py — langchain Source File
Architecture documentation for __init__.py, a python file in the langchain codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 362401db_c01d_1875_a0b4_19de456df9c2["__init__.py"] 3888b2bf_bffe_7c16_770f_a406d400119c["importlib"] 362401db_c01d_1875_a0b4_19de456df9c2 --> 3888b2bf_bffe_7c16_770f_a406d400119c fdba230d_a403_6744_bc5b_7eb58b19f200["importlib.metadata"] 362401db_c01d_1875_a0b4_19de456df9c2 --> fdba230d_a403_6744_bc5b_7eb58b19f200 eefab93e_c3f9_d0fd_c7a7_310371e9d16f["langchain_ollama.chat_models"] 362401db_c01d_1875_a0b4_19de456df9c2 --> eefab93e_c3f9_d0fd_c7a7_310371e9d16f 0297c4ad_9082_68e6_3e5b_3caf4001da4e["langchain_ollama.embeddings"] 362401db_c01d_1875_a0b4_19de456df9c2 --> 0297c4ad_9082_68e6_3e5b_3caf4001da4e b44d4491_221c_f696_01cc_f4c388dae365["langchain_ollama.llms"] 362401db_c01d_1875_a0b4_19de456df9c2 --> b44d4491_221c_f696_01cc_f4c388dae365 style 362401db_c01d_1875_a0b4_19de456df9c2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""This is the langchain_ollama package.
Provides infrastructure for interacting with the [Ollama](https://ollama.com/)
service.
!!! note
**Newly added in 0.3.4:** `validate_model_on_init` param on all models.
This parameter allows you to validate the model exists in Ollama locally on
initialization. If set to `True`, it will raise an error if the model does not
exist locally. This is useful for ensuring that the model is available before
attempting to use it, especially in environments where models may not be
pre-downloaded.
"""
from importlib import metadata
from importlib.metadata import PackageNotFoundError
from langchain_ollama.chat_models import ChatOllama
from langchain_ollama.embeddings import OllamaEmbeddings
from langchain_ollama.llms import OllamaLLM
def _raise_package_not_found_error() -> None:
raise PackageNotFoundError
try:
if __package__ is None:
_raise_package_not_found_error()
__version__ = metadata.version(__package__)
except metadata.PackageNotFoundError:
# Case where package metadata is not available.
__version__ = ""
del metadata # optional, avoids polluting the results of dir(__package__)
__all__ = [
"ChatOllama",
"OllamaEmbeddings",
"OllamaLLM",
"__version__",
]
Domain
Subdomains
Dependencies
- importlib
- importlib.metadata
- langchain_ollama.chat_models
- langchain_ollama.embeddings
- langchain_ollama.llms
Source
Frequently Asked Questions
What does __init__.py do?
__init__.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What functions are defined in __init__.py?
__init__.py defines 3 function(s): __package__, __version__, _raise_package_not_found_error.
What does __init__.py depend on?
__init__.py imports 5 module(s): importlib, importlib.metadata, langchain_ollama.chat_models, langchain_ollama.embeddings, langchain_ollama.llms.
Where is __init__.py in the architecture?
__init__.py is located at libs/partners/ollama/langchain_ollama/__init__.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/partners/ollama/langchain_ollama).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free