From f470398e99a97293bd242bb7ea6083d326484f6e Mon Sep 17 00:00:00 2001 From: Andrei Fajardo <92402603+nerdai@users.noreply.github.com> Date: Sat, 24 Feb 2024 10:46:49 -0500 Subject: [PATCH] remove helper classes (#11354) --- .../pyproject.toml | 2 - .../llama-index-agent-openai/pyproject.toml | 1 - .../pyproject.toml | 2 - .../pyproject.toml | 2 - .../pyproject.toml | 1 - .../pyproject.toml | 1 - .../pyproject.toml | 1 - .../pyproject.toml | 3 - .../pyproject.toml | 2 + .../pyproject.toml | 4 +- .../pyproject.toml | 2 + .../llama-index-llms-bedrock/pyproject.toml | 2 - .../llama-index-llms-dashscope/pyproject.toml | 1 - .../llama-index-llms-openai/pyproject.toml | 1 - .../pyproject.toml | 1 - .../.gitignore | 153 ---------- .../BUILD | 3 - .../Makefile | 17 -- .../README.md | 1 - .../replicate_multi_modal/BUILD | 1 - .../replicate_multi_modal/__init__.py | 3 - .../replicate_multi_modal/base.py | 288 ------------------ .../pyproject.toml | 62 ---- .../tests/BUILD | 1 - .../tests/__init__.py | 0 ..._multi-modal-llms_replicate_multi_modal.py | 7 - .../pyproject.toml | 1 - .../pyproject.toml | 2 - .../pyproject.toml | 3 - .../llama-index-readers-joplin/pyproject.toml | 1 - .../pyproject.toml | 2 - .../pyproject.toml | 2 - .../llama-index-tools-azure-cv/pyproject.toml | 1 - .../pyproject.toml | 1 - .../pyproject.toml | 1 - .../llama-index-tools-google/pyproject.toml | 1 - .../llama-index-tools-requests/pyproject.toml | 1 - .../pyproject.toml | 1 - .../pyproject.toml | 1 - .../llama-index-tools-zapier/pyproject.toml | 1 - .../pyproject.toml | 2 - .../pyproject.toml | 1 - .../pyproject.toml | 1 - .../pyproject.toml | 1 - .../llama-index-packs-self-rag/pyproject.toml | 1 - .../llama-index-packs-vanna/pyproject.toml | 1 - 46 files changed, 7 insertions(+), 581 deletions(-) delete mode 100644 llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/.gitignore delete mode 100644 llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/BUILD delete mode 100644 llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/Makefile delete mode 100644 llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/README.md delete mode 100644 llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/llama_index/multi_modal_llms/replicate_multi_modal/BUILD delete mode 100644 llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/llama_index/multi_modal_llms/replicate_multi_modal/__init__.py delete mode 100644 llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/llama_index/multi_modal_llms/replicate_multi_modal/base.py delete mode 100644 llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/pyproject.toml delete mode 100644 llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/tests/BUILD delete mode 100644 llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/tests/__init__.py delete mode 100644 llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/tests/test_multi-modal-llms_replicate_multi_modal.py diff --git a/llama-index-integrations/agent/llama-index-agent-openai-legacy/pyproject.toml b/llama-index-integrations/agent/llama-index-agent-openai-legacy/pyproject.toml index 119cfa4ba8..3ab4916648 100644 --- a/llama-index-integrations/agent/llama-index-agent-openai-legacy/pyproject.toml +++ b/llama-index-integrations/agent/llama-index-agent-openai-legacy/pyproject.toml @@ -12,10 +12,8 @@ contains_example = false import_path = "llama_index.agent.openai_legacy" [tool.llamahub.class_authors] -BaseOpenAIAgent = "llama-index" ContextRetrieverOpenAIAgent = "llama-index" FnRetrieverOpenAIAgent = "llama-index" -OpenAIAgent = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/agent/llama-index-agent-openai/pyproject.toml b/llama-index-integrations/agent/llama-index-agent-openai/pyproject.toml index b15d5612a7..24b1ee7799 100644 --- a/llama-index-integrations/agent/llama-index-agent-openai/pyproject.toml +++ b/llama-index-integrations/agent/llama-index-agent-openai/pyproject.toml @@ -13,7 +13,6 @@ import_path = "llama_index.agent.openai" [tool.llamahub.class_authors] OpenAIAgent = "llama-index" -OpenAIAgentWorker = "llama-index" OpenAIAssistantAgent = "llama-index" [tool.mypy] diff --git a/llama-index-integrations/embeddings/llama-index-embeddings-adapter/pyproject.toml b/llama-index-integrations/embeddings/llama-index-embeddings-adapter/pyproject.toml index 8a114c0da3..6ad492dfb7 100644 --- a/llama-index-integrations/embeddings/llama-index-embeddings-adapter/pyproject.toml +++ b/llama-index-integrations/embeddings/llama-index-embeddings-adapter/pyproject.toml @@ -13,9 +13,7 @@ import_path = "llama_index.embeddings.adapter" [tool.llamahub.class_authors] AdapterEmbeddingModel = "llama-index" -BaseAdapter = "llama-index" LinearAdapterEmbeddingModel = "llama-index" -LinearLayer = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/embeddings/llama-index-embeddings-azure-openai/pyproject.toml b/llama-index-integrations/embeddings/llama-index-embeddings-azure-openai/pyproject.toml index 1187a98253..db868c19b4 100644 --- a/llama-index-integrations/embeddings/llama-index-embeddings-azure-openai/pyproject.toml +++ b/llama-index-integrations/embeddings/llama-index-embeddings-azure-openai/pyproject.toml @@ -12,8 +12,6 @@ contains_example = false import_path = "llama_index.embeddings.azure_openai" [tool.llamahub.class_authors] -AsyncAzureOpenAI = "llama-index" -AzureOpenAI = "llama-index" AzureOpenAIEmbedding = "llama-index" [tool.mypy] diff --git a/llama-index-integrations/embeddings/llama-index-embeddings-bedrock/pyproject.toml b/llama-index-integrations/embeddings/llama-index-embeddings-bedrock/pyproject.toml index d8cf560d59..3cf9cc1ffe 100644 --- a/llama-index-integrations/embeddings/llama-index-embeddings-bedrock/pyproject.toml +++ b/llama-index-integrations/embeddings/llama-index-embeddings-bedrock/pyproject.toml @@ -13,7 +13,6 @@ import_path = "llama_index.embeddings.bedrock" [tool.llamahub.class_authors] BedrockEmbedding = "llama-index" -Models = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/pyproject.toml b/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/pyproject.toml index eae37b0671..a454d61ae3 100644 --- a/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/pyproject.toml +++ b/llama-index-integrations/embeddings/llama-index-embeddings-huggingface/pyproject.toml @@ -14,7 +14,6 @@ import_path = "llama_index.embeddings.huggingface" [tool.llamahub.class_authors] HuggingFaceEmbedding = "llama-index" HuggingFaceInferenceAPIEmbedding = "llama-index" -HuggingFaceInferenceAPIEmbeddings = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/embeddings/llama-index-embeddings-llm-rails/pyproject.toml b/llama-index-integrations/embeddings/llama-index-embeddings-llm-rails/pyproject.toml index d5e5a6b027..4217635f0f 100644 --- a/llama-index-integrations/embeddings/llama-index-embeddings-llm-rails/pyproject.toml +++ b/llama-index-integrations/embeddings/llama-index-embeddings-llm-rails/pyproject.toml @@ -13,7 +13,6 @@ import_path = "llama_index.embeddings.llm_rails" [tool.llamahub.class_authors] LLMRailsEmbedding = "llama-index" -LLMRailsEmbeddings = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/embeddings/llama-index-embeddings-openai/pyproject.toml b/llama-index-integrations/embeddings/llama-index-embeddings-openai/pyproject.toml index e022877b7c..383f7b9487 100644 --- a/llama-index-integrations/embeddings/llama-index-embeddings-openai/pyproject.toml +++ b/llama-index-integrations/embeddings/llama-index-embeddings-openai/pyproject.toml @@ -13,9 +13,6 @@ import_path = "llama_index.embeddings.openai" [tool.llamahub.class_authors] OpenAIEmbedding = "llama-index" -OpenAIEmbeddingMode = "llama-index" -OpenAIEmbeddingModeModel = "llama-index" -OpenAIEmbeddingModelType = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/pyproject.toml b/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/pyproject.toml index 2b969a0784..65c5805db8 100644 --- a/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/pyproject.toml +++ b/llama-index-integrations/indices/llama-index-indices-managed-llama-cloud/pyproject.toml @@ -13,6 +13,8 @@ import_path = "llama_index.indices.managed.llama_cloud" [tool.llamahub.class_authors] LlamaCloudIndex = "llama-index" + +[tool.llamahub.secondary_class_authors] LlamaCloudRetriever = "llama-index" [tool.mypy] diff --git a/llama-index-integrations/indices/llama-index-indices-managed-vectara/pyproject.toml b/llama-index-integrations/indices/llama-index-indices-managed-vectara/pyproject.toml index 6dd2208789..30a7071e64 100644 --- a/llama-index-integrations/indices/llama-index-indices-managed-vectara/pyproject.toml +++ b/llama-index-integrations/indices/llama-index-indices-managed-vectara/pyproject.toml @@ -12,8 +12,10 @@ contains_example = false import_path = "llama_index.indices.managed.vectara" [tool.llamahub.class_authors] -VectaraAutoRetriever = "llama-index" VectaraIndex = "llama-index" + +[tool.llamahub.secondary_class_authors] +VectaraAutoRetriever = "llama-index" VectaraRetriever = "llama-index" [tool.mypy] diff --git a/llama-index-integrations/indices/llama-index-indices-managed-zilliz/pyproject.toml b/llama-index-integrations/indices/llama-index-indices-managed-zilliz/pyproject.toml index aa7c2433d9..8b157dcca8 100644 --- a/llama-index-integrations/indices/llama-index-indices-managed-zilliz/pyproject.toml +++ b/llama-index-integrations/indices/llama-index-indices-managed-zilliz/pyproject.toml @@ -13,6 +13,8 @@ import_path = "llama_index.indices.managed.zilliz" [tool.llamahub.class_authors] ZillizCloudPipelineIndex = "llama-index" + +[tool.llamahub.secondary_class_authors] ZillizCloudPipelineRetriever = "llama-index" [tool.mypy] diff --git a/llama-index-integrations/llms/llama-index-llms-bedrock/pyproject.toml b/llama-index-integrations/llms/llama-index-llms-bedrock/pyproject.toml index eef1a573ef..d2320280a6 100644 --- a/llama-index-integrations/llms/llama-index-llms-bedrock/pyproject.toml +++ b/llama-index-integrations/llms/llama-index-llms-bedrock/pyproject.toml @@ -13,8 +13,6 @@ import_path = "llama_index.llms.bedrock" [tool.llamahub.class_authors] Bedrock = "llama-index" -completion_response_to_chat_response = "llama-index" -completion_with_retry = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/llms/llama-index-llms-dashscope/pyproject.toml b/llama-index-integrations/llms/llama-index-llms-dashscope/pyproject.toml index 75231d5c45..5daa07408f 100644 --- a/llama-index-integrations/llms/llama-index-llms-dashscope/pyproject.toml +++ b/llama-index-integrations/llms/llama-index-llms-dashscope/pyproject.toml @@ -13,7 +13,6 @@ import_path = "llama_index.llms.dashscope" [tool.llamahub.class_authors] DashScope = "llama-index" -DashScopeGenerationModels = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/llms/llama-index-llms-openai/pyproject.toml b/llama-index-integrations/llms/llama-index-llms-openai/pyproject.toml index 0e7965912b..1319956ecd 100644 --- a/llama-index-integrations/llms/llama-index-llms-openai/pyproject.toml +++ b/llama-index-integrations/llms/llama-index-llms-openai/pyproject.toml @@ -15,7 +15,6 @@ import_path = "llama_index.llms.openai" AsyncOpenAI = "llama-index" OpenAI = "llama-index" SyncOpenAI = "llama-index" -Tokenizer = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-dashscope/pyproject.toml b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-dashscope/pyproject.toml index 9ba99d8510..ee2f2331a0 100644 --- a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-dashscope/pyproject.toml +++ b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-dashscope/pyproject.toml @@ -13,7 +13,6 @@ import_path = "llama_index.multi_modal_llms.dashscope" [tool.llamahub.class_authors] DashScopeMultiModal = "llama-index" -DashScopeMultiModalModels = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/.gitignore b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/.gitignore deleted file mode 100644 index 990c18de22..0000000000 --- a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/.gitignore +++ /dev/null @@ -1,153 +0,0 @@ -llama_index/_static -.DS_Store -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -bin/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -etc/ -include/ -lib/ -lib64/ -parts/ -sdist/ -share/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -.ruff_cache - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints -notebooks/ - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ -pyvenv.cfg - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# Jetbrains -.idea -modules/ -*.swp - -# VsCode -.vscode - -# pipenv -Pipfile -Pipfile.lock - -# pyright -pyrightconfig.json diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/BUILD b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/BUILD deleted file mode 100644 index 0896ca890d..0000000000 --- a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/BUILD +++ /dev/null @@ -1,3 +0,0 @@ -poetry_requirements( - name="poetry", -) diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/Makefile b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/Makefile deleted file mode 100644 index b9eab05aa3..0000000000 --- a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -GIT_ROOT ?= $(shell git rev-parse --show-toplevel) - -help: ## Show all Makefile targets. - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}' - -format: ## Run code autoformatters (black). - pre-commit install - git ls-files | xargs pre-commit run black --files - -lint: ## Run linters: pre-commit (black, ruff, codespell) and mypy - pre-commit install && git ls-files | xargs pre-commit run --show-diff-on-failure --files - -test: ## Run tests via pytest. - pytest tests - -watch-docs: ## Build and watch documentation. - sphinx-autobuild docs/ docs/_build/html --open-browser --watch $(GIT_ROOT)/llama_index/ diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/README.md b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/README.md deleted file mode 100644 index 0a724061ee..0000000000 --- a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/README.md +++ /dev/null @@ -1 +0,0 @@ -# LlamaIndex Multi-Modal-Llms Integration: Replicate Multi Modal diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/llama_index/multi_modal_llms/replicate_multi_modal/BUILD b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/llama_index/multi_modal_llms/replicate_multi_modal/BUILD deleted file mode 100644 index db46e8d6c9..0000000000 --- a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/llama_index/multi_modal_llms/replicate_multi_modal/BUILD +++ /dev/null @@ -1 +0,0 @@ -python_sources() diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/llama_index/multi_modal_llms/replicate_multi_modal/__init__.py b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/llama_index/multi_modal_llms/replicate_multi_modal/__init__.py deleted file mode 100644 index f7258fb831..0000000000 --- a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/llama_index/multi_modal_llms/replicate_multi_modal/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from llama_index.multi_modal_llms.replicate_multi_modal.base import ReplicateMultiModal - -__all__ = ["ReplicateMultiModal"] diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/llama_index/multi_modal_llms/replicate_multi_modal/base.py b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/llama_index/multi_modal_llms/replicate_multi_modal/base.py deleted file mode 100644 index 734c9a3e9f..0000000000 --- a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/llama_index/multi_modal_llms/replicate_multi_modal/base.py +++ /dev/null @@ -1,288 +0,0 @@ -import logging -from typing import Any, Callable, Dict, Optional, Sequence - -from llama_index.core.base.llms.types import ( - ChatMessage, - ChatResponse, - ChatResponseAsyncGen, - ChatResponseGen, - CompletionResponse, - CompletionResponseAsyncGen, - CompletionResponseGen, -) -from llama_index.core.bridge.pydantic import Field, PrivateAttr -from llama_index.core.callbacks import CallbackManager -from llama_index.core.constants import DEFAULT_CONTEXT_WINDOW, DEFAULT_NUM_OUTPUTS -from llama_index.core.base.llms.generic_utils import ( - messages_to_prompt as generic_messages_to_prompt, -) -from llama_index.core.multi_modal_llms import ( - MultiModalLLM, - MultiModalLLMMetadata, -) -from llama_index.core.schema import ImageDocument - -_logger = logging.getLogger(__name__) - -REPLICATE_MULTI_MODAL_LLM_MODELS = { - "llava-13b": "yorickvp/llava-13b:e272157381e2a3bf12df3a8edd1f38d1dbd736bbb7437277c8b34175f8fce358", - "fuyu-8b": "lucataco/fuyu-8b:42f23bc876570a46f5a90737086fbc4c3f79dd11753a28eaa39544dd391815e9", - "minigpt-4": "daanelson/minigpt-4:b96a2f33cc8e4b0aa23eacfce731b9c41a7d9466d9ed4e167375587b54db9423", - "cogvlm": "naklecha/cogvlm:ec3886f9ea85dd0aee216585be5e6d07b04c9650f7b8b08363a14eb89e207eb2", -} - - -class ReplicateMultiModal(MultiModalLLM): - model: str = Field(description="The Multi-Modal model to use from Replicate.") - temperature: float = Field( - description="The temperature to use for sampling. Adjusts randomness of outputs, greater than 1 is random and 0 is deterministic." - ) - max_new_tokens: int = Field( - description=" The maximum numbers of tokens to generate, ignoring the number of tokens in the prompt" - ) - context_window: int = Field( - description="The maximum number of context tokens for the model." - ) - prompt_key: str = Field(description="The key to use for the prompt in API calls.") - image_key: str = Field(description="The key to use for the image in API calls.") - top_p: float = Field( - description="When decoding text, samples from the top p percentage of most likely tokens; lower to ignore less likely tokens." - ) - num_beams: int = Field(description="Number of beams for beam search decoding.") - repetition_penalty: float = Field( - description="Penalty for repeated words in generated text; 1 is no penalty, values greater than 1 discourage repetition, less than 1 encourage it." - ) - additional_kwargs: Dict[str, Any] = Field( - default_factory=dict, description="Additional kwargs for the Replicate API." - ) - - _messages_to_prompt: Callable = PrivateAttr() - _completion_to_prompt: Callable = PrivateAttr() - - def __init__( - self, - model: str = REPLICATE_MULTI_MODAL_LLM_MODELS["fuyu-8b"], - temperature: float = 0.75, - max_new_tokens: int = 512, - num_input_files: int = 1, - additional_kwargs: Optional[Dict[str, Any]] = None, - context_window: int = DEFAULT_CONTEXT_WINDOW, - prompt_key: str = "prompt", - image_key: str = "image", - repetition_penalty: Optional[float] = 1.0, - num_beams: Optional[int] = 1, - top_p: Optional[float] = 0.9, - messages_to_prompt: Optional[Callable] = None, - completion_to_prompt: Optional[Callable] = None, - callback_manager: Optional[CallbackManager] = None, - ) -> None: - self._messages_to_prompt = messages_to_prompt or generic_messages_to_prompt - self._completion_to_prompt = completion_to_prompt or (lambda x: x) - - super().__init__( - model=model, - temperature=temperature, - max_new_tokens=max_new_tokens, - num_input_files=num_input_files, - repetition_penalty=repetition_penalty, - num_beams=num_beams, - top_p=top_p, - additional_kwargs=additional_kwargs or {}, - context_window=context_window, - prompt_key=prompt_key, - image_key=image_key, - callback_manager=callback_manager, - ) - - @classmethod - def class_name(cls) -> str: - return "replicate_multi_modal_llm" - - @property - def metadata(self) -> MultiModalLLMMetadata: - """Multi Modal LLM metadata.""" - return MultiModalLLMMetadata( - context_window=self.context_window, - num_output=DEFAULT_NUM_OUTPUTS, - model_name=self.model, - ) - - @property - def _model_kwargs(self) -> Dict[str, Any]: - base_kwargs: Dict[str, Any] = { - "temperature": self.temperature, - "max_length": self.context_window, - "max_new_tokens": self.max_new_tokens, - "num_beams": self.num_beams, - "repetition_penalty": self.repetition_penalty, - "top_p": self.top_p, - } - return { - **base_kwargs, - **self.additional_kwargs, - } - - def _get_multi_modal_chat_messages( - self, prompt: str, image_document: ImageDocument, **kwargs: Any - ) -> Dict[str, Any]: - if image_document.image_path: - # load local image file and pass file handler to replicate - try: - return { - self.prompt_key: prompt, - self.image_key: open(image_document.image_path, "rb"), - **self._model_kwargs, - **kwargs, - } - except FileNotFoundError: - raise FileNotFoundError( - "Could not load local image file. Please check whether the file exists" - ) - elif image_document.image_url: - # load remote image url and pass file url to replicate - return { - self.prompt_key: prompt, - self.image_key: image_document.image_url, - **self._model_kwargs, - **kwargs, - } - else: - raise FileNotFoundError( - "Could not load image file. Please check whether the file exists" - ) - - def complete( - self, prompt: str, image_documents: Sequence[ImageDocument], **kwargs: Any - ) -> CompletionResponse: - response_gen = self.stream_complete(prompt, image_documents, **kwargs) - response_list = list(response_gen) - final_response = response_list[-1] - final_response.delta = None - return final_response - - def stream_complete( - self, prompt: str, image_documents: Sequence[ImageDocument], **kwargs: Any - ) -> CompletionResponseGen: - try: - import replicate - except ImportError: - raise ImportError( - "Could not import replicate library." - "Please install replicate with `pip install replicate`" - ) - - # TODO: at the current moment, only support uploading one image document - if len(image_documents) > 1: - _logger.warning( - "ReplicateMultiModal currently only supports uploading one image document" - "we are using the first image document for completion." - ) - - prompt = self._completion_to_prompt(prompt) - input_dict = self._get_multi_modal_chat_messages( - # using the first image for single image completion - prompt, - image_documents[0], - **kwargs, - ) - if self.model not in REPLICATE_MULTI_MODAL_LLM_MODELS.values(): - raise ValueError( - f"Unknown model {self.model!r}. Please provide a valid Replicate Multi-Modal model name in:" - f" {', '.join(REPLICATE_MULTI_MODAL_LLM_MODELS.values())}" - ) - - response_iter = replicate.run(self.model, input=input_dict) - - def gen() -> CompletionResponseGen: - text = "" - for delta in response_iter: - text += delta - yield CompletionResponse( - delta=delta, - text=text, - ) - - return gen() - - def chat( - self, - messages: Sequence[ChatMessage], - **kwargs: Any, - ) -> ChatResponse: - raise NotImplementedError - - def stream_chat( - self, - messages: Sequence[ChatMessage], - **kwargs: Any, - ) -> ChatResponseGen: - raise NotImplementedError - - # ===== Async Endpoints ===== - - async def acomplete( - self, prompt: str, image_documents: Sequence[ImageDocument], **kwargs: Any - ) -> CompletionResponse: - response_gen = self.stream_complete(prompt, image_documents, **kwargs) - response_list = list(response_gen) - final_response = response_list[-1] - final_response.delta = None - return final_response - - async def astream_complete( - self, prompt: str, image_documents: Sequence[ImageDocument], **kwargs: Any - ) -> CompletionResponseAsyncGen: - try: - import replicate - except ImportError: - raise ImportError( - "Could not import replicate library." - "Please install replicate with `pip install replicate`" - ) - - # TODO: at the current moment, only support uploading one image document - if len(image_documents) > 1: - _logger.warning( - "ReplicateMultiModal currently only supports uploading one image document" - "we are using the first image document for completion." - ) - - prompt = self._completion_to_prompt(prompt) - input_dict = self._get_multi_modal_chat_messages( - # using the first image for single image completion - prompt, - image_documents[0], - **kwargs, - ) - if self.model not in REPLICATE_MULTI_MODAL_LLM_MODELS.values(): - raise ValueError( - f"Unknown model {self.model!r}. Please provide a valid Replicate Multi-Modal model name in:" - f" {', '.join(REPLICATE_MULTI_MODAL_LLM_MODELS.values())}" - ) - - response_iter = replicate.run(self.model, input=input_dict) - - async def gen() -> CompletionResponseAsyncGen: - text = "" - for delta in response_iter: - text += delta - yield CompletionResponse( - delta=delta, - text=text, - ) - - return gen() - - async def achat( - self, - messages: Sequence[ChatMessage], - **kwargs: Any, - ) -> ChatResponse: - raise NotImplementedError - - async def astream_chat( - self, - messages: Sequence[ChatMessage], - **kwargs: Any, - ) -> ChatResponseAsyncGen: - raise NotImplementedError diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/pyproject.toml b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/pyproject.toml deleted file mode 100644 index a53086b365..0000000000 --- a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/pyproject.toml +++ /dev/null @@ -1,62 +0,0 @@ -[build-system] -build-backend = "poetry.core.masonry.api" -requires = ["poetry-core"] - -[tool.codespell] -check-filenames = true -check-hidden = true -skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb" - -[tool.llamahub] -contains_example = false -import_path = "llama_index.multi_modal_llms.replicate_multi_modal" - -[tool.llamahub.class_authors] -ReplicateMultiModal = "llama-index" - -[tool.mypy] -disallow_untyped_defs = true -exclude = ["_static", "build", "examples", "notebooks", "venv"] -ignore_missing_imports = true -python_version = "3.8" - -[tool.poetry] -authors = ["Your Name <you@example.com>"] -description = "llama-index multi-modal-llms replicate multi modal integration" -exclude = ["**/BUILD"] -license = "MIT" -name = "llama-index-multi-modal-llms-replicate-multi-modal" -readme = "README.md" -version = "0.1.3" - -[tool.poetry.dependencies] -python = ">=3.8.1,<4.0" -llama-index-core = "^0.10.1" - -[tool.poetry.group.dev.dependencies] -ipython = "8.10.0" -jupyter = "^1.0.0" -mypy = "0.991" -pre-commit = "3.2.0" -pylint = "2.15.10" -pytest = "7.2.1" -pytest-mock = "3.11.1" -ruff = "0.0.292" -tree-sitter-languages = "^1.8.0" -types-Deprecated = ">=0.1.0" -types-PyYAML = "^6.0.12.12" -types-protobuf = "^4.24.0.4" -types-redis = "4.5.5.0" -types-requests = "2.28.11.8" -types-setuptools = "67.1.0.0" - -[tool.poetry.group.dev.dependencies.black] -extras = ["jupyter"] -version = "<=23.9.1,>=23.7.0" - -[tool.poetry.group.dev.dependencies.codespell] -extras = ["toml"] -version = ">=v2.2.6" - -[[tool.poetry.packages]] -include = "llama_index/" diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/tests/BUILD b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/tests/BUILD deleted file mode 100644 index dabf212d7e..0000000000 --- a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/tests/BUILD +++ /dev/null @@ -1 +0,0 @@ -python_tests() diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/tests/__init__.py b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/tests/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/tests/test_multi-modal-llms_replicate_multi_modal.py b/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/tests/test_multi-modal-llms_replicate_multi_modal.py deleted file mode 100644 index fd71ffe8ba..0000000000 --- a/llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-replicate-multi-modal/tests/test_multi-modal-llms_replicate_multi_modal.py +++ /dev/null @@ -1,7 +0,0 @@ -from llama_index.core.multi_modal_llms.base import MultiModalLLM -from llama_index.multi_modal_llms.replicate_multi_modal import ReplicateMultiModal - - -def test_embedding_class(): - names_of_base_classes = [b.__name__ for b in ReplicateMultiModal.__mro__] - assert MultiModalLLM.__name__ in names_of_base_classes diff --git a/llama-index-integrations/program/llama-index-program-evaporate/pyproject.toml b/llama-index-integrations/program/llama-index-program-evaporate/pyproject.toml index daa45bc60f..858fc64d66 100644 --- a/llama-index-integrations/program/llama-index-program-evaporate/pyproject.toml +++ b/llama-index-integrations/program/llama-index-program-evaporate/pyproject.toml @@ -12,7 +12,6 @@ contains_example = false import_path = "llama_index.program.evaporate" [tool.llamahub.class_authors] -BaseEvaporateProgram = "llama-index" DFEvaporateProgram = "llama-index" [tool.mypy] diff --git a/llama-index-integrations/readers/llama-index-readers-clickhouse/pyproject.toml b/llama-index-integrations/readers/llama-index-readers-clickhouse/pyproject.toml index 6ba06e3eb9..6bde1f3539 100644 --- a/llama-index-integrations/readers/llama-index-readers-clickhouse/pyproject.toml +++ b/llama-index-integrations/readers/llama-index-readers-clickhouse/pyproject.toml @@ -13,8 +13,6 @@ import_path = "llama_index.readers.clickhouse" [tool.llamahub.class_authors] ClickHouseReader = "llama-index" -escape_str = "llama-index" -format_list_to_string = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/readers/llama-index-readers-gpt-repo/pyproject.toml b/llama-index-integrations/readers/llama-index-readers-gpt-repo/pyproject.toml index 8d05f88c2e..eeeb56e079 100644 --- a/llama-index-integrations/readers/llama-index-readers-gpt-repo/pyproject.toml +++ b/llama-index-integrations/readers/llama-index-readers-gpt-repo/pyproject.toml @@ -13,9 +13,6 @@ import_path = "llama_index.readers.gpt_repo" [tool.llamahub.class_authors] GPTRepoReader = "mpoon" -get_ignore_list = "llama-index" -process_repository = "llama-index" -should_ignore = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/readers/llama-index-readers-joplin/pyproject.toml b/llama-index-integrations/readers/llama-index-readers-joplin/pyproject.toml index fb6773d946..81e6261ac7 100644 --- a/llama-index-integrations/readers/llama-index-readers-joplin/pyproject.toml +++ b/llama-index-integrations/readers/llama-index-readers-joplin/pyproject.toml @@ -13,7 +13,6 @@ import_path = "llama_index.readers.joplin" [tool.llamahub.class_authors] JoplinReader = "alondmnt" -LINK_NOTE_TEMPLATE = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/readers/llama-index-readers-myscale/pyproject.toml b/llama-index-integrations/readers/llama-index-readers-myscale/pyproject.toml index 7371b60f43..30854b07bf 100644 --- a/llama-index-integrations/readers/llama-index-readers-myscale/pyproject.toml +++ b/llama-index-integrations/readers/llama-index-readers-myscale/pyproject.toml @@ -13,8 +13,6 @@ import_path = "llama_index.readers.myscale" [tool.llamahub.class_authors] MyScaleReader = "llama-index" -escape_str = "llama-index" -format_list_to_string = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/response_synthesizers/llama-index-response-synthesizers-google/pyproject.toml b/llama-index-integrations/response_synthesizers/llama-index-response-synthesizers-google/pyproject.toml index fb0dfccb82..23fce426e2 100644 --- a/llama-index-integrations/response_synthesizers/llama-index-response-synthesizers-google/pyproject.toml +++ b/llama-index-integrations/response_synthesizers/llama-index-response-synthesizers-google/pyproject.toml @@ -13,8 +13,6 @@ import_path = "llama_index.response_synthesizers.google" [tool.llamahub.class_authors] GoogleTextSynthesizer = "llama-index" -SynthesizedResponse = "llama-index" -set_google_config = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/tools/llama-index-tools-azure-cv/pyproject.toml b/llama-index-integrations/tools/llama-index-tools-azure-cv/pyproject.toml index c7e0fd37e7..41ee0901ee 100644 --- a/llama-index-integrations/tools/llama-index-tools-azure-cv/pyproject.toml +++ b/llama-index-integrations/tools/llama-index-tools-azure-cv/pyproject.toml @@ -13,7 +13,6 @@ import_path = "llama_index.tools.azure_cv" [tool.llamahub.class_authors] AzureCVToolSpec = "ajhofmann" -CV_URL_TMPL = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/tools/llama-index-tools-azure-translate/pyproject.toml b/llama-index-integrations/tools/llama-index-tools-azure-translate/pyproject.toml index 0a9d6b61c3..cef3094efc 100644 --- a/llama-index-integrations/tools/llama-index-tools-azure-translate/pyproject.toml +++ b/llama-index-integrations/tools/llama-index-tools-azure-translate/pyproject.toml @@ -13,7 +13,6 @@ import_path = "llama_index.tools.azure_translate" [tool.llamahub.class_authors] AzureTranslateToolSpec = "ajhofmann" -ENDPOINT_BASE_URL = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/tools/llama-index-tools-bing-search/pyproject.toml b/llama-index-integrations/tools/llama-index-tools-bing-search/pyproject.toml index a850d18c52..3cc4bf5e19 100644 --- a/llama-index-integrations/tools/llama-index-tools-bing-search/pyproject.toml +++ b/llama-index-integrations/tools/llama-index-tools-bing-search/pyproject.toml @@ -13,7 +13,6 @@ import_path = "llama_index.tools.bing_search" [tool.llamahub.class_authors] BingSearchToolSpec = "ajhofmann" -ENDPOINT_BASE_URL = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/tools/llama-index-tools-google/pyproject.toml b/llama-index-integrations/tools/llama-index-tools-google/pyproject.toml index 1518feb3c1..ab15d7e1bb 100644 --- a/llama-index-integrations/tools/llama-index-tools-google/pyproject.toml +++ b/llama-index-integrations/tools/llama-index-tools-google/pyproject.toml @@ -15,7 +15,6 @@ import_path = "llama_index.tools.google" GmailToolSpec = "ajhofmann" GoogleCalendarToolSpec = "ajhofmann" GoogleSearchToolSpec = "ajhofmann" -QUERY_URL_TMPL = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/tools/llama-index-tools-requests/pyproject.toml b/llama-index-integrations/tools/llama-index-tools-requests/pyproject.toml index c9bff451cd..e95b74d852 100644 --- a/llama-index-integrations/tools/llama-index-tools-requests/pyproject.toml +++ b/llama-index-integrations/tools/llama-index-tools-requests/pyproject.toml @@ -12,7 +12,6 @@ contains_example = false import_path = "llama_index.tools.requests" [tool.llamahub.class_authors] -INVALID_URL_PROMPT = "llama-index" RequestsToolSpec = "ajhofmann" [tool.mypy] diff --git a/llama-index-integrations/tools/llama-index-tools-vector-db/pyproject.toml b/llama-index-integrations/tools/llama-index-tools-vector-db/pyproject.toml index ee08c4ebeb..247206d735 100644 --- a/llama-index-integrations/tools/llama-index-tools-vector-db/pyproject.toml +++ b/llama-index-integrations/tools/llama-index-tools-vector-db/pyproject.toml @@ -12,7 +12,6 @@ contains_example = false import_path = "llama_index.tools.vector_db" [tool.llamahub.class_authors] -VectorDB = "llama-index" VectorDBToolSpec = "jerryjliu" [tool.mypy] diff --git a/llama-index-integrations/tools/llama-index-tools-wolfram-alpha/pyproject.toml b/llama-index-integrations/tools/llama-index-tools-wolfram-alpha/pyproject.toml index 1b84cd6ccb..0ab126feda 100644 --- a/llama-index-integrations/tools/llama-index-tools-wolfram-alpha/pyproject.toml +++ b/llama-index-integrations/tools/llama-index-tools-wolfram-alpha/pyproject.toml @@ -12,7 +12,6 @@ contains_example = false import_path = "llama_index.tools.wolfram_alpha" [tool.llamahub.class_authors] -QUERY_URL_TMPL = "llama-index" WolframAlphaToolSpec = "ajhofmann" [tool.mypy] diff --git a/llama-index-integrations/tools/llama-index-tools-zapier/pyproject.toml b/llama-index-integrations/tools/llama-index-tools-zapier/pyproject.toml index b3f516904f..8bc4a66160 100644 --- a/llama-index-integrations/tools/llama-index-tools-zapier/pyproject.toml +++ b/llama-index-integrations/tools/llama-index-tools-zapier/pyproject.toml @@ -12,7 +12,6 @@ contains_example = false import_path = "llama_index.tools.zapier" [tool.llamahub.class_authors] -ACTION_URL_TMPL = "llama-index" ZapierToolSpec = "ajhofmann" [tool.mypy] diff --git a/llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/pyproject.toml b/llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/pyproject.toml index 0aaf35cafb..bc7278d31e 100644 --- a/llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/pyproject.toml +++ b/llama-index-integrations/vector_stores/llama-index-vector-stores-azureaisearch/pyproject.toml @@ -14,8 +14,6 @@ import_path = "llama_index.vector_stores.azureaisearch" [tool.llamahub.class_authors] AzureAISearchVectorStore = "llama-index" CognitiveSearchVectorStore = "llama-index" -IndexManagement = "llama-index" -MetadataIndexFieldType = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/vector_stores/llama-index-vector-stores-google/pyproject.toml b/llama-index-integrations/vector_stores/llama-index-vector-stores-google/pyproject.toml index a2afc489f2..dfe95c3f5b 100644 --- a/llama-index-integrations/vector_stores/llama-index-vector-stores-google/pyproject.toml +++ b/llama-index-integrations/vector_stores/llama-index-vector-stores-google/pyproject.toml @@ -13,7 +13,6 @@ import_path = "llama_index.vector_stores.google" [tool.llamahub.class_authors] GoogleVectorStore = "llama-index" -set_google_config = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/pyproject.toml b/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/pyproject.toml index c766769a1e..1d837dd279 100644 --- a/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/pyproject.toml +++ b/llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/pyproject.toml @@ -12,7 +12,6 @@ contains_example = false import_path = "llama_index.vector_stores.opensearch" [tool.llamahub.class_authors] -OpensearchVectorClient = "llama-index" OpensearchVectorStore = "llama-index" [tool.mypy] diff --git a/llama-index-packs/llama-index-packs-agent-search-retriever/pyproject.toml b/llama-index-packs/llama-index-packs-agent-search-retriever/pyproject.toml index 2463d516f1..f46a14bf17 100644 --- a/llama-index-packs/llama-index-packs-agent-search-retriever/pyproject.toml +++ b/llama-index-packs/llama-index-packs-agent-search-retriever/pyproject.toml @@ -12,7 +12,6 @@ contains_example = true import_path = "llama_index.packs.agent_search_retriever" [tool.llamahub.class_authors] -AgentSearchRetriever = "llama-index" AgentSearchRetrieverPack = "logan-markewich" [tool.mypy] diff --git a/llama-index-packs/llama-index-packs-self-rag/pyproject.toml b/llama-index-packs/llama-index-packs-self-rag/pyproject.toml index 71edfaf0e4..4dd1561fbb 100644 --- a/llama-index-packs/llama-index-packs-self-rag/pyproject.toml +++ b/llama-index-packs/llama-index-packs-self-rag/pyproject.toml @@ -13,7 +13,6 @@ import_path = "llama_index.packs.self_rag" [tool.llamahub.class_authors] SelfRAGPack = "mmaatouk" -SelfRAGQueryEngine = "llama-index" [tool.mypy] disallow_untyped_defs = true diff --git a/llama-index-packs/llama-index-packs-vanna/pyproject.toml b/llama-index-packs/llama-index-packs-vanna/pyproject.toml index d14821a5fd..bc73b75816 100644 --- a/llama-index-packs/llama-index-packs-vanna/pyproject.toml +++ b/llama-index-packs/llama-index-packs-vanna/pyproject.toml @@ -13,7 +13,6 @@ import_path = "llama_index.packs.vanna" [tool.llamahub.class_authors] VannaPack = "jerryjliu" -VannaQueryEngine = "llama-index" [tool.mypy] disallow_untyped_defs = true -- GitLab