Skip to content

Commit fb5f15c

Browse files
gonericlaude
andcommitted
deps: remove langchain dependency
Remove langchain and associated dependencies to simplify the codebase and reduce exposure to third-party dependency issues. Removed dependencies: - langchain~=0.3.10 - langchain-core~=0.3.81 - langchain-ollama~=0.3.5 - langchain-text-splitters~=0.3.11 Removed files: - ansible_ai_connect/ai/api/model_pipelines/langchain/ (entire directory) - configuration.py - pipelines.py - tests/test_pipeline.py Refactored ollama module to be fully self-contained: Configuration (ollama/configuration.py): - Created OllamaConfiguration extending BaseConfig directly - Created OllamaBasePipelineConfiguration - Removed dependency on langchain configuration classes Pipelines (ollama/pipelines.py): - Created custom OllamaClient for direct Ollama API communication - Moved all utility functions from langchain module: * message_to_string() * create_role_outline() * unwrap_role_answer() * unwrap_message_with_yaml_answer() * unwrap_playbook_answer() * unwrap_task_answer() - Implemented all pipeline classes without langchain: * OllamaMetaData * OllamaCompletionsPipeline * OllamaPlaybookGenerationPipeline * OllamaRoleGenerationPipeline * OllamaRoleExplanationPipeline (returns "nop" health check - not implemented) * OllamaPlaybookExplanationPipeline Tests (ollama/tests/test_pipelines.py): - Migrated relevant tests from deleted langchain/tests/test_pipeline.py - Added comprehensive test coverage for: * Unwrap functions (task, playbook, role, message parsing) * Completions pipeline with mocked requests.post * Playbook generation pipeline (with and without outline, custom prompt) * Role generation pipeline (with and without outline) * Playbook explanation pipeline (with custom prompt) - All tests updated to mock requests.post instead of langchain's FakeListLLM - Prevents AttributeError from patching non-existent symbols Updated configuration: - pyproject.toml: Removed langchain dependencies and pyright path - requirements.txt: Regenerated without langchain (15 fewer packages) - uv.lock: Regenerated without langchain dependencies - .github/workflows/pyright.yml: Removed langchain from CI dependencies All functionality preserved. Type checking passes with pyright. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 374e646 commit fb5f15c

File tree

13 files changed

+787
-1364
lines changed

13 files changed

+787
-1364
lines changed

.github/workflows/pyright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ jobs:
2121
python-version: '3.12'
2222
- name: install
2323
run: |
24-
pip install pyright django boto3 requests prometheus_client backoff django_prometheus langchain langchain-ollama django-health-check aiohttp ansible-lint ansible_anonymizer
24+
pip install pyright django boto3 requests prometheus_client backoff django_prometheus django-health-check aiohttp ansible-lint ansible_anonymizer
2525
pyright

ansible_ai_connect/ai/api/model_pipelines/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import ansible_ai_connect.ai.api.model_pipelines.dummy.pipelines # noqa
33
import ansible_ai_connect.ai.api.model_pipelines.http.configuration # noqa
44
import ansible_ai_connect.ai.api.model_pipelines.http.pipelines # noqa
5-
import ansible_ai_connect.ai.api.model_pipelines.langchain.pipelines # noqa
65
import ansible_ai_connect.ai.api.model_pipelines.llamacpp.configuration # noqa
76
import ansible_ai_connect.ai.api.model_pipelines.llamacpp.pipelines # noqa
87
import ansible_ai_connect.ai.api.model_pipelines.llamastack.configuration # noqa

ansible_ai_connect/ai/api/model_pipelines/langchain/__init__.py

Whitespace-only changes.

ansible_ai_connect/ai/api/model_pipelines/langchain/configuration.py

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)