TalkPipe 0.9.1__tar.gz → 0.9.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {talkpipe-0.9.1 → talkpipe-0.9.2}/.github/workflows/ci-cd.yml +3 -3
- {talkpipe-0.9.1 → talkpipe-0.9.2}/CHANGELOG.md +12 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/Dockerfile +1 -1
- {talkpipe-0.9.1 → talkpipe-0.9.2}/PKG-INFO +22 -5
- {talkpipe-0.9.1 → talkpipe-0.9.2}/README.md +11 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/quickstart.md +11 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/README.md +5 -1
- {talkpipe-0.9.1 → talkpipe-0.9.2}/pyproject.toml +15 -5
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/__init__.py +4 -1
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/app/chatterlang_reference_browser.py +74 -35
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/app/chatterlang_reference_generator.py +27 -10
- talkpipe-0.9.2/src/talkpipe/app/static/unit-docs.html +1 -0
- talkpipe-0.9.2/src/talkpipe/app/static/unit-docs.txt +1 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/chatterlang/registry.py +26 -6
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/llm/config.py +3 -2
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/llm/embedding_adapters.py +7 -1
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/llm/prompt_adapters.py +139 -3
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/search/lancedb.py +2 -2
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe.egg-info/PKG-INFO +22 -5
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe.egg-info/SOURCES.txt +0 -2
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe.egg-info/requires.txt +14 -4
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/conftest.py +28 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/app/test_chatterlang_reference_browser.py +69 -29
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/llm/test_chat.py +37 -6
- talkpipe-0.9.1/src/talkpipe/app/static/unit-docs.html +0 -1
- talkpipe-0.9.1/src/talkpipe/app/static/unit-docs.txt +0 -1
- talkpipe-0.9.1/src/talkpipe/operations/signatures.py +0 -445
- talkpipe-0.9.1/tests/talkpipe/operations/test_signatures.py +0 -652
- {talkpipe-0.9.1 → talkpipe-0.9.2}/.bandit +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/.dockerignore +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/.github/CICD.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/.github/ISSUE_TEMPLATE/release-checklist.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/.github/SECURITY.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/.github/dependabot.yml +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/.gitignore +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/.safety-project.ini +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/.vscode/settings.json +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/.vscode/tasks.json +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/CLAUDE.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/COPYRIGHT +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/LICENSE +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/bin/config-analyzer.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/bin/config_bash +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/.gitignore +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/LLMChat.png +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/LLMEvaluateWebPage.png +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/README.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/TalkPipe.png +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/TalkPipe.xcf +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/api-reference/README.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/api-reference/chatterlang-script.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/api-reference/chatterlang-server.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/api-reference/chatterlang-workbench.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/api-reference/talkpipe-plugin-manager.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/api-reference/talkpipe-ref.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/architecture/README.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/architecture/chatterlang.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/architecture/configuration.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/architecture/extending-talkpipe.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/architecture/pipe-api.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/architecture/streaming.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/make_structure_diagram.sh +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/structure.tex +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/talkpipe_diagram.png +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/.gitignore +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_1-Document_Indexing/README.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_1-Document_Indexing/Step_1_CreateSyntheticData.sh +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_1-Document_Indexing/Step_2_IndexStories.sh +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_1-Document_Indexing/Step_3_SearchStories.sh +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_1-Document_Indexing/stories.json +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_1-Document_Indexing/story_search_ui.yml +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_2-Search_by_Example_and_RAG/README.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_2-Search_by_Example_and_RAG/Step_1_CreateVectorDatabase.sh +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_2-Search_by_Example_and_RAG/Step_2_SearchByExample.sh +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_2-Search_by_Example_and_RAG/Step_3_SpecializedRag.sh +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_2-Search_by_Example_and_RAG/step_3_extras.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_2-Search_by_Example_and_RAG/story_by_example_ui.yml +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_3_Report_Writing/README.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_3_Report_Writing/Step_1_ExecutiveSummaryGeneration.sh +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_3_Report_Writing/Step_2_DetailedAnalysisReportGeneration.sh +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_3_Report_Writing/Step_3_MultiFormatReportGeneration.sh +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_3_Report_Writing/file_structure.md +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_3_Report_Writing/multi_format_ui.yml +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_3_Report_Writing/report_topic_ui.yml +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_3_Report_Writing/step3_extras.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_3_Report_Writing/step_1_extras.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/docs/tutorials/Tutorial_3_Report_Writing/step_2_extras.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/pytest.ini +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/setup.cfg +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/setup.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/app/__init__.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/app/chatterlang_script.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/app/chatterlang_serve.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/app/chatterlang_workbench.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/app/static/.gitignore +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/app/static/favicon.ico +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/app/talkpipe_plugin_manager.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/chatterlang/__init__.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/chatterlang/compiler.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/chatterlang/parsers.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/data/__init__.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/data/email.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/data/extraction.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/data/html.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/data/mongo.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/data/rss.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/llm/__init__.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/llm/chat.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/llm/embedding.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/operations/__init__.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/operations/filtering.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/operations/matrices.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/operations/thread_ops.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/operations/transforms.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/pipe/__init__.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/pipe/basic.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/pipe/core.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/pipe/fork.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/pipe/io.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/pipe/math.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/search/abstract.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/search/simplevectordb.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/search/whoosh.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/util/__init__.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/util/collections.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/util/config.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/util/data_manipulation.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/util/doc_extraction.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/util/os.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe/util/plugin_loader.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe.egg-info/dependency_links.txt +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe.egg-info/entry_points.txt +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/src/talkpipe.egg-info/top_level.txt +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/test-workflow.yml +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/app/test_chatterlang_reference_generator.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/app/test_chatterlang_script.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/app/test_chatterlang_serve.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/app/test_talkpipe_plugin_manager.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/chatterlang/test_chatterlang_workbench.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/chatterlang/test_compiler.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/chatterlang/test_parsers.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/data/sample_feed.pkl +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/data/test.docx +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/data/test_email.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/data/test_extraction.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/data/test_html.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/data/test_html_exceptions.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/data/test_mogomock.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/data/test_mongo.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/data/test_mongo_integration.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/data/test_rss.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/llm/test_embedding.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/operations/test_filtering.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/operations/test_matrices.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/operations/test_threading.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/operations/test_transforms.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/pipe/test_basic.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/pipe/test_core.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/pipe/test_fork.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/pipe/test_io.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/pipe/test_math.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/search/test_lancedb.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/search/test_simplevectordb.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/search/test_whoosh.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/test_documentation_examples.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/util/test_collections.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/util/test_config.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/util/test_data_manipulation.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/util/test_doc_extraction.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/util/test_plugin_loader.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/talkpipe/util/test_util.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/test_security_vulnerabilities.py +0 -0
- {talkpipe-0.9.1 → talkpipe-0.9.2}/tests/testutils.py +0 -0
|
@@ -40,7 +40,7 @@ jobs:
|
|
|
40
40
|
- name: Install dependencies
|
|
41
41
|
run: |
|
|
42
42
|
python -m pip install --upgrade pip
|
|
43
|
-
pip install -e .[dev]
|
|
43
|
+
pip install -e ".[dev,all]"
|
|
44
44
|
|
|
45
45
|
- name: Run tests with coverage
|
|
46
46
|
run: |
|
|
@@ -50,7 +50,7 @@ jobs:
|
|
|
50
50
|
if: matrix.python-version == '3.11'
|
|
51
51
|
uses: codecov/codecov-action@v5
|
|
52
52
|
with:
|
|
53
|
-
|
|
53
|
+
files: ./coverage.xml
|
|
54
54
|
flags: unittests
|
|
55
55
|
|
|
56
56
|
security-scan:
|
|
@@ -68,7 +68,7 @@ jobs:
|
|
|
68
68
|
- name: Install dependencies for security scan
|
|
69
69
|
run: |
|
|
70
70
|
python -m pip install --upgrade pip
|
|
71
|
-
pip install -e .[dev]
|
|
71
|
+
pip install -e ".[dev,all]"
|
|
72
72
|
pip install bandit safety
|
|
73
73
|
|
|
74
74
|
- name: Run Bandit security scan
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.2
|
|
4
|
+
### Improvements
|
|
5
|
+
- Added ability for sources and segments to have multiple names in chatterlang.
|
|
6
|
+
- Removed signature segments.
|
|
7
|
+
- Added Anthropic as a chat provider.
|
|
8
|
+
- Updated the install options so that not all the providers have to be installed. Include the provider
|
|
9
|
+
you want as a parameter (e.g. pip install talkpipe[anthropic]). Current options are anthropic, openai,
|
|
10
|
+
and ollama. Use "all" to install all three.
|
|
11
|
+
|
|
12
|
+
## 0.9.1
|
|
13
|
+
Forgot to import the lancedb module in talkpipe/__init__.py, so it wasn't registering the segments.
|
|
14
|
+
|
|
3
15
|
## 0.9.0
|
|
4
16
|
### New and Updated Segments and Sources
|
|
5
17
|
- Added **set**, which simply assigns some constant to a key.
|
|
@@ -37,7 +37,7 @@ COPY --chown=builder:builder tests/ tests/
|
|
|
37
37
|
RUN python3 -m pip install --user --upgrade pip setuptools wheel build
|
|
38
38
|
RUN python3 -m pip install --user numpy pandas matplotlib scikit-learn scipy
|
|
39
39
|
ENV SETUPTOOLS_SCM_PRETEND_VERSION_FOR_TALKPIPE=0.1.0
|
|
40
|
-
RUN python3 -m pip install --user -e .[dev]
|
|
40
|
+
RUN python3 -m pip install --user -e .[dev,all]
|
|
41
41
|
RUN python3 -m pytest --log-cli-level=DEBUG
|
|
42
42
|
RUN python3 -m build --wheel
|
|
43
43
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: talkpipe
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.2
|
|
4
4
|
Summary: Python internal and external DSL for writing generative AI analytics
|
|
5
5
|
Author-email: Travis Bauer <tlbauer@sandia.gov>
|
|
6
6
|
Maintainer-email: Travis Bauer <tlbauer@sandia.gov>
|
|
@@ -16,32 +16,38 @@ License-File: LICENSE
|
|
|
16
16
|
Requires-Dist: prompt_toolkit
|
|
17
17
|
Requires-Dist: parsy
|
|
18
18
|
Requires-Dist: pydantic
|
|
19
|
-
Requires-Dist: ollama
|
|
20
19
|
Requires-Dist: requests
|
|
21
20
|
Requires-Dist: numpy
|
|
22
|
-
Requires-Dist: numba==0.
|
|
21
|
+
Requires-Dist: numba==0.62.1
|
|
23
22
|
Requires-Dist: python-docx
|
|
24
23
|
Requires-Dist: pandas
|
|
25
24
|
Requires-Dist: feedparser
|
|
26
25
|
Requires-Dist: readability-lxml
|
|
27
26
|
Requires-Dist: lxml
|
|
28
27
|
Requires-Dist: lxml_html_clean
|
|
29
|
-
Requires-Dist: openai
|
|
30
28
|
Requires-Dist: fastapi[standard]
|
|
31
29
|
Requires-Dist: ipywidgets
|
|
32
30
|
Requires-Dist: pymongo
|
|
33
31
|
Requires-Dist: umap-learn
|
|
34
32
|
Requires-Dist: scikit-learn
|
|
35
|
-
Requires-Dist: cryptography
|
|
36
33
|
Requires-Dist: uvicorn
|
|
37
34
|
Requires-Dist: whoosh
|
|
38
35
|
Requires-Dist: lancedb
|
|
39
36
|
Requires-Dist: deprecated
|
|
37
|
+
Requires-Dist: pyyaml
|
|
40
38
|
Provides-Extra: dev
|
|
41
39
|
Requires-Dist: pytest; extra == "dev"
|
|
42
40
|
Requires-Dist: pytest-mock; extra == "dev"
|
|
43
41
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
44
42
|
Requires-Dist: mongomock; extra == "dev"
|
|
43
|
+
Provides-Extra: ollama
|
|
44
|
+
Requires-Dist: ollama; extra == "ollama"
|
|
45
|
+
Provides-Extra: openai
|
|
46
|
+
Requires-Dist: openai; extra == "openai"
|
|
47
|
+
Provides-Extra: anthropic
|
|
48
|
+
Requires-Dist: anthropic; extra == "anthropic"
|
|
49
|
+
Provides-Extra: all
|
|
50
|
+
Requires-Dist: talkpipe[anthropic,ollama,openai]; extra == "all"
|
|
45
51
|
Dynamic: license-file
|
|
46
52
|
|
|
47
53
|
<center><img src="docs/TalkPipe.png" width=500></center>
|
|
@@ -108,6 +114,17 @@ Install TalkPipe:
|
|
|
108
114
|
pip install talkpipe
|
|
109
115
|
```
|
|
110
116
|
|
|
117
|
+
For LLM support, install the provider(s) you need:
|
|
118
|
+
```bash
|
|
119
|
+
# Install specific providers
|
|
120
|
+
pip install talkpipe[openai] # For OpenAI
|
|
121
|
+
pip install talkpipe[ollama] # For Ollama
|
|
122
|
+
pip install talkpipe[anthropic] # For Anthropic Claude
|
|
123
|
+
|
|
124
|
+
# Or install all LLM providers
|
|
125
|
+
pip install talkpipe[all]
|
|
126
|
+
```
|
|
127
|
+
|
|
111
128
|
Create a multi-turn chat function in 2 lines:
|
|
112
129
|
```python
|
|
113
130
|
from talkpipe.chatterlang import compiler
|
|
@@ -62,6 +62,17 @@ Install TalkPipe:
|
|
|
62
62
|
pip install talkpipe
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
+
For LLM support, install the provider(s) you need:
|
|
66
|
+
```bash
|
|
67
|
+
# Install specific providers
|
|
68
|
+
pip install talkpipe[openai] # For OpenAI
|
|
69
|
+
pip install talkpipe[ollama] # For Ollama
|
|
70
|
+
pip install talkpipe[anthropic] # For Anthropic Claude
|
|
71
|
+
|
|
72
|
+
# Or install all LLM providers
|
|
73
|
+
pip install talkpipe[all]
|
|
74
|
+
```
|
|
75
|
+
|
|
65
76
|
Create a multi-turn chat function in 2 lines:
|
|
66
77
|
```python
|
|
67
78
|
from talkpipe.chatterlang import compiler
|
|
@@ -8,6 +8,17 @@ Welcome to TalkPipe! This guide will help you get up and running quickly with Ta
|
|
|
8
8
|
pip install talkpipe
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
For LLM support, install the provider(s) you need:
|
|
12
|
+
```bash
|
|
13
|
+
# Install specific providers
|
|
14
|
+
pip install talkpipe[openai] # For OpenAI
|
|
15
|
+
pip install talkpipe[ollama] # For Ollama
|
|
16
|
+
pip install talkpipe[anthropic] # For Anthropic Claude
|
|
17
|
+
|
|
18
|
+
# Or install all LLM providers
|
|
19
|
+
pip install talkpipe[all]
|
|
20
|
+
```
|
|
21
|
+
|
|
11
22
|
## Basic Concepts
|
|
12
23
|
|
|
13
24
|
TalkPipe provides two ways to build data processing pipelines:
|
|
@@ -152,7 +152,11 @@ This isn't hypothetical – it's exactly how these tutorials were designed to wo
|
|
|
152
152
|
### Start Running Immediately
|
|
153
153
|
One of TalkPipe's core strengths is getting you from idea to working prototype faster than traditional approaches:
|
|
154
154
|
|
|
155
|
-
1. **Install TalkPipe**:
|
|
155
|
+
1. **Install TalkPipe**:
|
|
156
|
+
```bash
|
|
157
|
+
pip install talkpipe[all] # Includes all LLM providers
|
|
158
|
+
# Or install specific providers: talkpipe[ollama], talkpipe[openai], talkpipe[anthropic]
|
|
159
|
+
```
|
|
156
160
|
2. **Run a tutorial**: `cd Tutorial_1-Document_Indexing && ./Step_1_CreateSyntheticData.sh`
|
|
157
161
|
3. **See results**: Working applications in minutes, not hours
|
|
158
162
|
|
|
@@ -24,27 +24,25 @@ dependencies = [
|
|
|
24
24
|
'prompt_toolkit',
|
|
25
25
|
'parsy',
|
|
26
26
|
'pydantic',
|
|
27
|
-
'ollama',
|
|
28
27
|
'requests',
|
|
29
28
|
'numpy',
|
|
30
|
-
'numba==0.
|
|
29
|
+
'numba==0.62.1',
|
|
31
30
|
'python-docx',
|
|
32
31
|
'pandas',
|
|
33
32
|
'feedparser',
|
|
34
33
|
'readability-lxml',
|
|
35
34
|
'lxml',
|
|
36
35
|
'lxml_html_clean',
|
|
37
|
-
'openai',
|
|
38
36
|
'fastapi[standard]',
|
|
39
37
|
'ipywidgets',
|
|
40
38
|
'pymongo',
|
|
41
39
|
'umap-learn',
|
|
42
40
|
'scikit-learn',
|
|
43
|
-
'cryptography',
|
|
44
41
|
'uvicorn',
|
|
45
42
|
'whoosh',
|
|
46
43
|
'lancedb',
|
|
47
|
-
'deprecated'
|
|
44
|
+
'deprecated',
|
|
45
|
+
'pyyaml'
|
|
48
46
|
]
|
|
49
47
|
dynamic = ["version"]
|
|
50
48
|
|
|
@@ -55,6 +53,18 @@ dev = [
|
|
|
55
53
|
'pytest-cov',
|
|
56
54
|
'mongomock'
|
|
57
55
|
]
|
|
56
|
+
ollama = [
|
|
57
|
+
'ollama'
|
|
58
|
+
]
|
|
59
|
+
openai = [
|
|
60
|
+
'openai'
|
|
61
|
+
]
|
|
62
|
+
anthropic = [
|
|
63
|
+
'anthropic'
|
|
64
|
+
]
|
|
65
|
+
all = [
|
|
66
|
+
'talkpipe[openai,ollama,anthropic]'
|
|
67
|
+
]
|
|
58
68
|
|
|
59
69
|
[project.scripts]
|
|
60
70
|
chatterlang_workbench = "talkpipe.app.chatterlang_workbench:main"
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import warnings
|
|
2
|
+
warnings.filterwarnings("ignore", message=".*ColPaliEmbeddings.*has conflict with protected namespace.*")
|
|
3
|
+
warnings.filterwarnings("ignore", message=".*SigLipEmbeddings.*has conflict with protected namespace.*")
|
|
4
|
+
|
|
1
5
|
from talkpipe.pipe.basic import *
|
|
2
6
|
from talkpipe.pipe.math import *
|
|
3
7
|
from talkpipe.pipe.io import *
|
|
@@ -12,7 +16,6 @@ from talkpipe.data.mongo import *
|
|
|
12
16
|
from talkpipe.operations.filtering import *
|
|
13
17
|
from talkpipe.operations.transforms import *
|
|
14
18
|
from talkpipe.operations.matrices import *
|
|
15
|
-
from talkpipe.operations.signatures import *
|
|
16
19
|
from talkpipe.app.chatterlang_serve import *
|
|
17
20
|
from talkpipe.search.whoosh import *
|
|
18
21
|
from talkpipe.search.simplevectordb import *
|
|
@@ -18,24 +18,36 @@ from talkpipe.util.doc_extraction import (
|
|
|
18
18
|
|
|
19
19
|
class TalkPipeDoc:
|
|
20
20
|
"""Represents a single TalkPipe component (class or function)."""
|
|
21
|
-
|
|
22
|
-
def __init__(self, name: str,
|
|
23
|
-
module: str, base_classes: List[str], docstring: str,
|
|
21
|
+
|
|
22
|
+
def __init__(self, name: str, chatterlang_names: List[str], doc_type: str,
|
|
23
|
+
module: str, base_classes: List[str], docstring: str,
|
|
24
24
|
parameters: Dict[str, str]):
|
|
25
25
|
self.name = name
|
|
26
|
-
self.
|
|
26
|
+
self.chatterlang_names = chatterlang_names # List of all names for this component
|
|
27
|
+
self.primary_name = chatterlang_names[0] # Primary name for display
|
|
27
28
|
self.doc_type = doc_type # 'Source', 'Segment', 'Field Segment'
|
|
28
29
|
self.module = module
|
|
29
30
|
self.base_classes = base_classes
|
|
30
31
|
self.docstring = docstring
|
|
31
32
|
self.parameters = parameters
|
|
32
33
|
|
|
34
|
+
@property
|
|
35
|
+
def chatterlang_name(self):
|
|
36
|
+
"""Backward compatibility property."""
|
|
37
|
+
return self.primary_name
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def all_names_display(self):
|
|
41
|
+
"""Display string showing all names."""
|
|
42
|
+
return ", ".join(self.chatterlang_names)
|
|
43
|
+
|
|
33
44
|
|
|
34
45
|
class TalkPipeBrowser:
|
|
35
46
|
"""Interactive terminal browser for TalkPipe documentation."""
|
|
36
|
-
|
|
47
|
+
|
|
37
48
|
def __init__(self):
|
|
38
|
-
self.components: Dict[str, TalkPipeDoc] = {}
|
|
49
|
+
self.components: Dict[str, TalkPipeDoc] = {} # Maps primary name to component
|
|
50
|
+
self.name_to_primary: Dict[str, str] = {} # Maps any name to primary name
|
|
39
51
|
self.modules: Dict[str, List[str]] = {}
|
|
40
52
|
self.load_components()
|
|
41
53
|
|
|
@@ -44,23 +56,38 @@ class TalkPipeBrowser:
|
|
|
44
56
|
return extract_parameters_dict(cls)
|
|
45
57
|
|
|
46
58
|
def load_components(self):
|
|
47
|
-
"""Load all components from the plugin system."""
|
|
59
|
+
"""Load all components from the plugin system, grouping multiple names for the same class."""
|
|
48
60
|
load_plugins() # Ensure plugins are loaded
|
|
49
|
-
|
|
61
|
+
|
|
62
|
+
# Group components by class to consolidate multiple names
|
|
63
|
+
class_to_names = {}
|
|
64
|
+
class_to_type = {}
|
|
65
|
+
|
|
50
66
|
# Load sources
|
|
51
67
|
for chatterlang_name, cls in input_registry.all.items():
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
68
|
+
if cls not in class_to_names:
|
|
69
|
+
class_to_names[cls] = []
|
|
70
|
+
class_to_type[cls] = "Source"
|
|
71
|
+
class_to_names[cls].append(chatterlang_name)
|
|
72
|
+
|
|
56
73
|
# Load segments
|
|
57
74
|
for chatterlang_name, cls in segment_registry.all.items():
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
if cls not in class_to_names:
|
|
76
|
+
class_to_names[cls] = []
|
|
77
|
+
class_to_type[cls] = detect_component_type(cls, "Segment")
|
|
78
|
+
class_to_names[cls].append(chatterlang_name)
|
|
79
|
+
|
|
80
|
+
# Create consolidated components
|
|
81
|
+
for cls, names in class_to_names.items():
|
|
82
|
+
# Sort names to ensure consistent primary name selection
|
|
83
|
+
names.sort()
|
|
84
|
+
primary_name = names[0]
|
|
85
|
+
|
|
86
|
+
component_info = extract_component_info(primary_name, cls, class_to_type[cls])
|
|
60
87
|
if component_info:
|
|
61
|
-
self._load_component_from_info(component_info)
|
|
88
|
+
self._load_component_from_info(component_info, names)
|
|
62
89
|
|
|
63
|
-
def _load_component_from_info(self, component_info):
|
|
90
|
+
def _load_component_from_info(self, component_info, all_names: List[str]):
|
|
64
91
|
"""Load a single component from ComponentInfo into the browser."""
|
|
65
92
|
try:
|
|
66
93
|
# Convert parameters from ParamSpec list to dict for browser compatibility
|
|
@@ -100,20 +127,26 @@ class TalkPipeBrowser:
|
|
|
100
127
|
# Create component
|
|
101
128
|
component = TalkPipeDoc(
|
|
102
129
|
name=component_info.name,
|
|
103
|
-
|
|
130
|
+
chatterlang_names=all_names,
|
|
104
131
|
doc_type=component_info.component_type,
|
|
105
132
|
module=component_info.module,
|
|
106
133
|
base_classes=component_info.base_classes,
|
|
107
134
|
docstring=component_info.docstring,
|
|
108
135
|
parameters=parameters
|
|
109
136
|
)
|
|
110
|
-
|
|
111
|
-
|
|
137
|
+
|
|
138
|
+
# Store component under primary name
|
|
139
|
+
primary_name = all_names[0]
|
|
140
|
+
self.components[primary_name] = component
|
|
141
|
+
|
|
142
|
+
# Map all names to the primary name for lookup
|
|
143
|
+
for name in all_names:
|
|
144
|
+
self.name_to_primary[name] = primary_name
|
|
112
145
|
|
|
113
146
|
# Group by module
|
|
114
147
|
if component_info.module not in self.modules:
|
|
115
148
|
self.modules[component_info.module] = []
|
|
116
|
-
self.modules[component_info.module].append(
|
|
149
|
+
self.modules[component_info.module].append(primary_name)
|
|
117
150
|
|
|
118
151
|
except Exception as e:
|
|
119
152
|
print(f"Warning: Failed to load component {component_info.chatterlang_name}: {e}")
|
|
@@ -223,24 +256,29 @@ class TalkPipeBrowser:
|
|
|
223
256
|
type_icon = "🔧"
|
|
224
257
|
else:
|
|
225
258
|
type_icon = "⚙️"
|
|
226
|
-
print(f"{type_icon} {comp.
|
|
259
|
+
print(f"{type_icon} {comp.all_names_display:<30} ({comp.name})")
|
|
227
260
|
print()
|
|
228
261
|
|
|
229
262
|
def _show_component(self, component_name: str):
|
|
230
263
|
"""Show detailed information about a component."""
|
|
231
|
-
# Try exact match
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
264
|
+
# Try exact match using name lookup
|
|
265
|
+
primary_name = self.name_to_primary.get(component_name)
|
|
266
|
+
component = None
|
|
267
|
+
|
|
268
|
+
if primary_name:
|
|
269
|
+
component = self.components.get(primary_name)
|
|
270
|
+
|
|
271
|
+
# If not found, try case-insensitive search in all names
|
|
235
272
|
if not component:
|
|
236
|
-
matches = [name for name in self.
|
|
273
|
+
matches = [name for name in self.name_to_primary.keys()
|
|
237
274
|
if name.lower() == component_name.lower()]
|
|
238
275
|
if matches:
|
|
239
|
-
|
|
276
|
+
primary_name = self.name_to_primary[matches[0]]
|
|
277
|
+
component = self.components[primary_name]
|
|
240
278
|
|
|
241
279
|
# If still not found, suggest similar names
|
|
242
280
|
if not component:
|
|
243
|
-
similar = [name for name in self.
|
|
281
|
+
similar = [name for name in self.name_to_primary.keys()
|
|
244
282
|
if component_name.lower() in name.lower()]
|
|
245
283
|
if similar:
|
|
246
284
|
print(f"Component '{component_name}' not found. Did you mean:")
|
|
@@ -252,7 +290,7 @@ class TalkPipeBrowser:
|
|
|
252
290
|
|
|
253
291
|
# Display component details
|
|
254
292
|
print(f"\n{'='*60}")
|
|
255
|
-
print(f"📋 {component.
|
|
293
|
+
print(f"📋 {component.all_names_display}")
|
|
256
294
|
print(f"{'='*60}")
|
|
257
295
|
print(f"Class/Function: {component.name}")
|
|
258
296
|
print(f"Type: {component.doc_type}")
|
|
@@ -281,11 +319,12 @@ class TalkPipeBrowser:
|
|
|
281
319
|
"""Search for components by name or description."""
|
|
282
320
|
search_lower = search_term.lower()
|
|
283
321
|
matches = []
|
|
284
|
-
|
|
322
|
+
|
|
285
323
|
for comp_name, component in self.components.items():
|
|
286
|
-
# Search in chatterlang
|
|
287
|
-
|
|
288
|
-
|
|
324
|
+
# Search in all chatterlang names, class name, and docstring
|
|
325
|
+
name_match = any(search_lower in name.lower() for name in component.chatterlang_names)
|
|
326
|
+
if (name_match or
|
|
327
|
+
search_lower in component.name.lower() or
|
|
289
328
|
search_lower in component.docstring.lower()):
|
|
290
329
|
matches.append(component)
|
|
291
330
|
|
|
@@ -296,14 +335,14 @@ class TalkPipeBrowser:
|
|
|
296
335
|
print(f"\nSearch Results for '{search_term}' ({len(matches)} found):")
|
|
297
336
|
print("-" * 60)
|
|
298
337
|
|
|
299
|
-
for component in sorted(matches, key=lambda x: x.
|
|
338
|
+
for component in sorted(matches, key=lambda x: x.primary_name):
|
|
300
339
|
if component.doc_type == "Source":
|
|
301
340
|
type_icon = "🔌"
|
|
302
341
|
elif component.doc_type == "Field Segment":
|
|
303
342
|
type_icon = "🔧"
|
|
304
343
|
else:
|
|
305
344
|
type_icon = "⚙️"
|
|
306
|
-
print(f"{type_icon} {component.
|
|
345
|
+
print(f"{type_icon} {component.all_names_display:<30} ({component.module})")
|
|
307
346
|
|
|
308
347
|
# Show brief description
|
|
309
348
|
if component.docstring:
|
|
@@ -38,25 +38,42 @@ def sanitize_id(text: str) -> str:
|
|
|
38
38
|
def analyze_registered_items() -> List[AnalyzedItem]:
|
|
39
39
|
"""
|
|
40
40
|
Analyze all registered sources and segments from the plugin system.
|
|
41
|
+
Groups items with multiple chatterlang names together.
|
|
41
42
|
"""
|
|
42
43
|
load_plugins() # Ensure plugins are loaded
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
|
|
45
|
+
# Group by class to handle multiple names for the same class
|
|
46
|
+
class_to_names = {}
|
|
47
|
+
|
|
45
48
|
# Process sources
|
|
46
49
|
for chatterlang_name, cls in input_registry.all.items():
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
if cls not in class_to_names:
|
|
51
|
+
class_to_names[cls] = {'names': [], 'type': 'Source'}
|
|
52
|
+
class_to_names[cls]['names'].append(chatterlang_name)
|
|
53
|
+
|
|
52
54
|
# Process segments
|
|
53
55
|
for chatterlang_name, cls in segment_registry.all.items():
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
if cls not in class_to_names:
|
|
57
|
+
component_type = detect_component_type(cls, 'Segment')
|
|
58
|
+
class_to_names[cls] = {'names': [], 'type': component_type}
|
|
59
|
+
class_to_names[cls]['names'].append(chatterlang_name)
|
|
60
|
+
|
|
61
|
+
analyzed_items = []
|
|
62
|
+
|
|
63
|
+
# Create AnalyzedItem objects with combined names
|
|
64
|
+
for cls, info in class_to_names.items():
|
|
65
|
+
# Sort names for consistent output
|
|
66
|
+
sorted_names = sorted(info['names'])
|
|
67
|
+
primary_name = sorted_names[0] # Use first alphabetically as primary
|
|
68
|
+
|
|
69
|
+
component_info = extract_component_info(primary_name, cls, info['type'])
|
|
56
70
|
if component_info:
|
|
57
71
|
item = convert_component_info_to_analyzed_item(component_info)
|
|
72
|
+
# If multiple names, combine them
|
|
73
|
+
if len(sorted_names) > 1:
|
|
74
|
+
item.chatterlang_name = ', '.join(sorted_names)
|
|
58
75
|
analyzed_items.append(item)
|
|
59
|
-
|
|
76
|
+
|
|
60
77
|
return analyzed_items
|
|
61
78
|
|
|
62
79
|
def convert_component_info_to_analyzed_item(component_info: ComponentInfo) -> AnalyzedItem:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Documentation generation failed: Command '['/tmp/build-env-6xf3v7m7/bin/python', 'src/talkpipe/app/chatterlang_reference_generator.py', 'src', 'src/talkpipe/app/static/unit-docs.html', 'src/talkpipe/app/static/unit-docs.txt']' returned non-zero exit status 1.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Documentation generation failed: Command '['/tmp/build-env-6xf3v7m7/bin/python', 'src/talkpipe/app/chatterlang_reference_generator.py', 'src', 'src/talkpipe/app/static/unit-docs.html', 'src/talkpipe/app/static/unit-docs.txt']' returned non-zero exit status 1.
|
|
@@ -31,17 +31,37 @@ class Registry(Generic[T]):
|
|
|
31
31
|
input_registry = Registry()
|
|
32
32
|
segment_registry = Registry()
|
|
33
33
|
|
|
34
|
-
def register_source(name: str):
|
|
35
|
-
"""Decorator to register a source module in the registry. """
|
|
34
|
+
def register_source(*names: str, name: str = None):
|
|
35
|
+
"""Decorator to register a source module with one or more names in the registry. """
|
|
36
|
+
# Handle backward compatibility with name= keyword argument
|
|
37
|
+
if name is not None:
|
|
38
|
+
if names:
|
|
39
|
+
raise ValueError("Cannot specify both positional names and 'name' keyword argument")
|
|
40
|
+
names = (name,)
|
|
41
|
+
|
|
42
|
+
if not names:
|
|
43
|
+
raise ValueError("At least one name must be provided")
|
|
44
|
+
|
|
36
45
|
def wrap(cls):
|
|
37
|
-
|
|
46
|
+
for source_name in names:
|
|
47
|
+
input_registry.register(cls, name=source_name)
|
|
38
48
|
return cls
|
|
39
49
|
return wrap
|
|
40
50
|
|
|
41
|
-
def register_segment(name: str):
|
|
42
|
-
"""Decorator to register a
|
|
51
|
+
def register_segment(*names: str, name: str = None):
|
|
52
|
+
"""Decorator to register a segment module with one or more names in the registry. """
|
|
53
|
+
# Handle backward compatibility with name= keyword argument
|
|
54
|
+
if name is not None:
|
|
55
|
+
if names:
|
|
56
|
+
raise ValueError("Cannot specify both positional names and 'name' keyword argument")
|
|
57
|
+
names = (name,)
|
|
58
|
+
|
|
59
|
+
if not names:
|
|
60
|
+
raise ValueError("At least one name must be provided")
|
|
61
|
+
|
|
43
62
|
def wrap(cls):
|
|
44
|
-
|
|
63
|
+
for segment_name in names:
|
|
64
|
+
segment_registry.register(cls, name=segment_name)
|
|
45
65
|
return cls
|
|
46
66
|
return wrap
|
|
47
67
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from typing import Dict, Type, TypeVar, List
|
|
2
|
-
from .prompt_adapters import AbstractLLMPromptAdapter, OllamaPromptAdapter, OpenAIPromptAdapter
|
|
2
|
+
from .prompt_adapters import AbstractLLMPromptAdapter, OllamaPromptAdapter, OpenAIPromptAdapter, AnthropicPromptAdapter
|
|
3
3
|
from .embedding_adapters import AbstractEmbeddingAdapter, OllamaEmbedderAdapter
|
|
4
4
|
|
|
5
5
|
T_PROMPTADAPTER = TypeVar("T_PROMPTADAPTER", bound=AbstractLLMPromptAdapter)
|
|
@@ -7,7 +7,8 @@ T_EMBEDDINGADAPTER = TypeVar("T_EMBEDDINGADAPTER", bound=AbstractEmbeddingAdapte
|
|
|
7
7
|
|
|
8
8
|
_promptAdapter:Dict[str, Type[T_PROMPTADAPTER]] = {
|
|
9
9
|
"ollama": OllamaPromptAdapter,
|
|
10
|
-
"openai": OpenAIPromptAdapter
|
|
10
|
+
"openai": OpenAIPromptAdapter,
|
|
11
|
+
"anthropic": AnthropicPromptAdapter
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
def registerPromptAdapter(name:str, promptAdapter:Type[T_PROMPTADAPTER]):
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from typing import List
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
|
-
import ollama
|
|
5
4
|
|
|
6
5
|
class AbstractEmbeddingAdapter:
|
|
7
6
|
"""Abstract class for embedding text.
|
|
@@ -49,6 +48,13 @@ class OllamaEmbedderAdapter(AbstractEmbeddingAdapter):
|
|
|
49
48
|
super().__init__(model, "ollama")
|
|
50
49
|
|
|
51
50
|
def execute(self, text: str) -> List[float]:
|
|
51
|
+
try:
|
|
52
|
+
import ollama
|
|
53
|
+
except ImportError:
|
|
54
|
+
raise ImportError(
|
|
55
|
+
"Ollama is not installed. Please install it with: pip install talkpipe[ollama]"
|
|
56
|
+
)
|
|
57
|
+
|
|
52
58
|
response = ollama.embed(
|
|
53
59
|
model=self.model_name,
|
|
54
60
|
input=text
|