Skip to content

fix: import dependencies for retrieval tools #2343

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

Closed
wants to merge 1 commit into from
Closed
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
25 changes: 15 additions & 10 deletions src/google/adk/tools/retrieval/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,29 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging

from .base_retrieval_tool import BaseRetrievalTool
from .files_retrieval import FilesRetrieval
from .llama_index_retrieval import LlamaIndexRetrieval

__all__ = [
'BaseRetrievalTool',
'FilesRetrieval',
'LlamaIndexRetrieval',
]
__all__ = ['BaseRetrievalTool']
logger = logging.getLogger('google_adk.' + __name__)

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

__all__.extend(['FilesRetrieval', 'LlamaIndexRetrieval'])
except ImportError:
logger.debug(
'The `llama-index-core` package is not installed. Please install it to '
'use LlamaIndex with agents, otherwise you can ignore this warning.'
)

try:
from .vertex_ai_rag_retrieval import VertexAiRagRetrieval

__all__.append('VertexAiRagRetrieval')
except ImportError:
import logging

logger = logging.getLogger('google_adk.' + __name__)
logger.debug(
'The Vertex sdk is not installed. If you want to use the Vertex RAG with'
' agents, please install it. If not, you can ignore this warning.'
Expand Down