-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
2,595 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,28 @@ | ||
from langchain_google_community.bigquery_vector_search import BigQueryVectorSearch | ||
from langchain_google_community.docai import DocAIParser, DocAIParsingResults | ||
from langchain_google_community.documentai_warehouse import DocumentAIWarehouseRetriever | ||
from langchain_google_community.gcs_directory import GCSDirectoryLoader | ||
from langchain_google_community.gcs_file import GCSFileLoader | ||
from langchain_google_community.gmail.loader import GMailLoader | ||
from langchain_google_community.gmail.toolkit import GmailToolkit | ||
from langchain_google_community.google_speech_to_text import GoogleSpeechToTextLoader | ||
from langchain_google_community.googledrive import GoogleDriveLoader | ||
from langchain_google_community.vertex_ai_search import ( | ||
VertexAIMultiTurnSearchRetriever, | ||
VertexAISearchRetriever, | ||
) | ||
|
||
__all__ = [ | ||
"BigQueryVectorSearch", | ||
"DocAIParser", | ||
"DocAIParsingResults", | ||
"DocumentAIWarehouseRetriever", | ||
"GCSDirectoryLoader", | ||
"GCSFileLoader", | ||
"GMailLoader", | ||
"GmailToolkit", | ||
"GoogleDriveLoader", | ||
"GoogleSpeechToTextLoader", | ||
"VertexAIMultiTurnSearchRetriever", | ||
"VertexAISearchRetriever", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""Utilities to init Vertex AI.""" | ||
|
||
from importlib import metadata | ||
from typing import Optional, Tuple | ||
|
||
from google.api_core.gapic_v1.client_info import ClientInfo | ||
|
||
|
||
def get_user_agent(module: Optional[str] = None) -> Tuple[str, str]: | ||
r"""Returns a custom user agent header. | ||
Args: | ||
module (Optional[str]): | ||
Optional. The module for a custom user agent header. | ||
Returns: | ||
Tuple[str, str] | ||
""" | ||
try: | ||
langchain_version = metadata.version("langchain") | ||
except metadata.PackageNotFoundError: | ||
langchain_version = "0.0.0" | ||
client_library_version = ( | ||
f"{langchain_version}-{module}" if module else langchain_version | ||
) | ||
return client_library_version, f"langchain/{client_library_version}" | ||
|
||
|
||
def get_client_info(module: Optional[str] = None) -> "ClientInfo": | ||
r"""Returns a client info object with a custom user agent header. | ||
Args: | ||
module (Optional[str]): | ||
Optional. The module for a custom user agent header. | ||
Returns: | ||
google.api_core.gapic_v1.client_info.ClientInfo | ||
""" | ||
client_library_version, user_agent = get_user_agent(module) | ||
return ClientInfo( | ||
client_library_version=client_library_version, | ||
user_agent=user_agent, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.