Skip to content

fix: Export FileRetrieval & LlamaIndexRetrieval only when llama-index-read-files package is installed #1415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions src/google/adk/tools/retrieval/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,24 @@
from .files_retrieval import FilesRetrieval
from .llama_index_retrieval import LlamaIndexRetrieval

__all__ = [
'BaseRetrievalTool',
'FilesRetrieval',
'LlamaIndexRetrieval',
]
__all__ = ['BaseRetrievalTool']

try:
from .files_retrieval import FilesRetrieval
from .llama_index_retrieval import LlamaIndexRetrieval

__all__.append('FilesRetrieval')
__all__.append('LlamaIndexRetrieval')
except ImportError:
import logging

logger = logging.getLogger('google_adk.' + __name__)
logger.debug(
'The llama-index-readers-file is not installed. If you want to use the'
' FileRetrieval or LLamaIndexRetrieval RAG with agents, please install'
' it. If not, you can ignore this warning.'
)


try:
from .vertex_ai_rag_retrieval import VertexAiRagRetrieval
Expand Down