mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-07 20:15:40 +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
32 lines
916 B
Python
32 lines
916 B
Python
"""Quickly verify that a list of Python files can be loaded by the Python interpreter
|
|
without raising any errors. Ran before running more expensive tests. Useful in
|
|
Makefiles.
|
|
|
|
If loading a file fails, the script prints the problematic filename and the detailed
|
|
error traceback.
|
|
"""
|
|
|
|
import random
|
|
import string
|
|
import sys
|
|
import traceback
|
|
from importlib.machinery import SourceFileLoader
|
|
|
|
if __name__ == "__main__":
|
|
files = sys.argv[1:]
|
|
has_failure = False
|
|
for file in files:
|
|
try:
|
|
module_name = "".join(
|
|
random.choice(string.ascii_letters) # noqa: S311
|
|
for _ in range(20)
|
|
)
|
|
SourceFileLoader(module_name, file).load_module()
|
|
except Exception:
|
|
has_failure = True
|
|
print(file) # noqa: T201
|
|
traceback.print_exc()
|
|
print() # noqa: T201
|
|
|
|
sys.exit(1 if has_failure else 0)
|