mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-07 03:56:39 +00:00
This PR adds scaffolding for langchain 1.0 entry package. Most contents have been removed. Currently remaining entrypoints for: * chat models * embedding models * memory -> trimming messages, filtering messages and counting tokens [we may remove this] * prompts -> we may remove some prompts * storage: primarily to support cache backed embeddings, may remove the kv store * tools -> report tool primitives Things to be added: * Selected agent implementations * Selected workflows * Common primitives: messages, Document * Primitives for type hinting: BaseChatModel, BaseEmbeddings * Selected retrievers * Selected text splitters Things to be removed: * Globals needs to be removed (needs an update in langchain core) Todos: * TBD indexing api (requires sqlalchemy which we don't want as a dependency) * Be explicit about public/private interfaces (e.g., likely rename chat_models.base.py to something more internal) * Remove dockerfiles * Update module doc-strings and README.md
35 lines
905 B
Python
35 lines
905 B
Python
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
# Getting the absolute path of the current file's directory
|
|
ABS_PATH = Path(__file__).resolve().parent
|
|
|
|
# Getting the absolute path of the project's root directory
|
|
PROJECT_DIR = ABS_PATH.parent.parent
|
|
|
|
|
|
# Loading the .env file if it exists
|
|
def _load_env() -> None:
|
|
dotenv_path = PROJECT_DIR / "tests" / "integration_tests" / ".env"
|
|
if dotenv_path.exists():
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv(dotenv_path)
|
|
|
|
|
|
_load_env()
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def test_dir() -> Path:
|
|
return PROJECT_DIR / "tests" / "integration_tests"
|
|
|
|
|
|
# This fixture returns a string containing the path to the cassette directory for the
|
|
# current module
|
|
@pytest.fixture(scope="module")
|
|
def vcr_cassette_dir(request: pytest.FixtureRequest) -> str:
|
|
module = Path(request.module.__file__)
|
|
return str(module.parent / "cassettes" / module.stem)
|