diff --git a/libs/tools/.gitignore b/libs/community/.gitignore similarity index 100% rename from libs/tools/.gitignore rename to libs/community/.gitignore diff --git a/libs/tools/LICENSE b/libs/community/LICENSE similarity index 100% rename from libs/tools/LICENSE rename to libs/community/LICENSE diff --git a/libs/tools/Makefile b/libs/community/Makefile similarity index 100% rename from libs/tools/Makefile rename to libs/community/Makefile diff --git a/libs/community/README.md b/libs/community/README.md new file mode 100644 index 00000000..2eae7e79 --- /dev/null +++ b/libs/community/README.md @@ -0,0 +1,9 @@ +# langchain-google-community + +This package contains the LangChain integrations for Google products that are not part of `langchain-google-vertexai` or `langchain-google-genai` packages. + +## Installation + +```bash +pip install -U langchain-google-community +``` diff --git a/libs/tools/langchain_google_tools/__init__.py b/libs/community/langchain_google_tools/__init__.py similarity index 100% rename from libs/tools/langchain_google_tools/__init__.py rename to libs/community/langchain_google_tools/__init__.py diff --git a/libs/tools/langchain_google_tools/bigquery_vector_search.py b/libs/community/langchain_google_tools/bigquery_vector_search.py similarity index 100% rename from libs/tools/langchain_google_tools/bigquery_vector_search.py rename to libs/community/langchain_google_tools/bigquery_vector_search.py diff --git a/libs/tools/langchain_google_tools/documentai_warehouse.py b/libs/community/langchain_google_tools/documentai_warehouse.py similarity index 100% rename from libs/tools/langchain_google_tools/documentai_warehouse.py rename to libs/community/langchain_google_tools/documentai_warehouse.py diff --git a/libs/tools/langchain_google_tools/gmail/__init__.py b/libs/community/langchain_google_tools/gmail/__init__.py similarity index 100% rename from libs/tools/langchain_google_tools/gmail/__init__.py rename to libs/community/langchain_google_tools/gmail/__init__.py diff --git a/libs/tools/langchain_google_tools/gmail/loader.py b/libs/community/langchain_google_tools/gmail/loader.py similarity index 100% rename from libs/tools/langchain_google_tools/gmail/loader.py rename to libs/community/langchain_google_tools/gmail/loader.py diff --git a/libs/tools/langchain_google_tools/gmail/toolkit.py b/libs/community/langchain_google_tools/gmail/toolkit.py similarity index 100% rename from libs/tools/langchain_google_tools/gmail/toolkit.py rename to libs/community/langchain_google_tools/gmail/toolkit.py diff --git a/libs/tools/langchain_google_tools/vertex_ai_search.py b/libs/community/langchain_google_tools/vertex_ai_search.py similarity index 100% rename from libs/tools/langchain_google_tools/vertex_ai_search.py rename to libs/community/langchain_google_tools/vertex_ai_search.py diff --git a/libs/tools/poetry.lock b/libs/community/poetry.lock similarity index 99% rename from libs/tools/poetry.lock rename to libs/community/poetry.lock index 838bc692..2e44d82b 100644 --- a/libs/tools/poetry.lock +++ b/libs/community/poetry.lock @@ -395,13 +395,13 @@ extended-testing = ["jinja2 (>=3,<4)"] [[package]] name = "langsmith" -version = "0.1.27" +version = "0.1.29" description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform." optional = false python-versions = ">=3.8.1,<4.0" files = [ - {file = "langsmith-0.1.27-py3-none-any.whl", hash = "sha256:d223176952b1525c958189ab1b894f5bd9891ec9177222f7a978aeee4bf1cc95"}, - {file = "langsmith-0.1.27.tar.gz", hash = "sha256:e0a339d976362051adf3fdbc43fcc7c00bb4615a401321ad7e556bd2dab556c0"}, + {file = "langsmith-0.1.29-py3-none-any.whl", hash = "sha256:5439f5bf25b00a43602aa1ddaba0a31d413ed920e7b20494070328f7e1ecbb86"}, + {file = "langsmith-0.1.29.tar.gz", hash = "sha256:60ba0bd889c6a2683d123f66dc5043368eb2f103c4eb69e382abf7ce69a9f7d6"}, ] [package.dependencies] diff --git a/libs/tools/pyproject.toml b/libs/community/pyproject.toml similarity index 96% rename from libs/tools/pyproject.toml rename to libs/community/pyproject.toml index 7318f11f..95f90387 100644 --- a/libs/tools/pyproject.toml +++ b/libs/community/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] -name = "langchain-google-tools" -version = "0.1.0" +name = "langchain-google-community" +version = "0.1.0rc0" description = "An integration package connecting miscellaneous Google's products and LangChain" authors = [] readme = "README.md" @@ -8,7 +8,7 @@ repository = "https://github.com/langchain-ai/langchain-google" license = "MIT" [tool.poetry.urls] -"Source Code" = "https://github.com/langchain-ai/langchain-google/tree/main/libs/tools" +"Source Code" = "https://github.com/langchain-ai/langchain-google/tree/main/libs/community" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" diff --git a/libs/tools/tests/integration_tests/__init__.py b/libs/community/tests/integration_tests/__init__.py similarity index 100% rename from libs/tools/tests/integration_tests/__init__.py rename to libs/community/tests/integration_tests/__init__.py diff --git a/libs/tools/tests/integration_tests/fake.py b/libs/community/tests/integration_tests/fake.py similarity index 100% rename from libs/tools/tests/integration_tests/fake.py rename to libs/community/tests/integration_tests/fake.py diff --git a/libs/tools/tests/integration_tests/test_bigquery_vector_search.py b/libs/community/tests/integration_tests/test_bigquery_vector_search.py similarity index 100% rename from libs/tools/tests/integration_tests/test_bigquery_vector_search.py rename to libs/community/tests/integration_tests/test_bigquery_vector_search.py diff --git a/libs/tools/tests/integration_tests/test_docai_warehoure_retriever.py b/libs/community/tests/integration_tests/test_docai_warehoure_retriever.py similarity index 100% rename from libs/tools/tests/integration_tests/test_docai_warehoure_retriever.py rename to libs/community/tests/integration_tests/test_docai_warehoure_retriever.py diff --git a/libs/tools/tests/integration_tests/test_vertex_ai_search.py b/libs/community/tests/integration_tests/test_vertex_ai_search.py similarity index 100% rename from libs/tools/tests/integration_tests/test_vertex_ai_search.py rename to libs/community/tests/integration_tests/test_vertex_ai_search.py diff --git a/libs/tools/README.md b/libs/tools/README.md deleted file mode 100644 index 101fed80..00000000 --- a/libs/tools/README.md +++ /dev/null @@ -1,107 +0,0 @@ -# langchain-google-genai - -This package contains the LangChain integrations for Gemini through their generative-ai SDK. - -## Installation - -```bash -pip install -U langchain-google-genai -``` - -### Image utilities -To use image utility methods, like loading images from GCS urls, install with extras group 'images': - -```bash -pip install -e "langchain-google-genai[images]" -``` - -## Chat Models - -This package contains the `ChatGoogleGenerativeAI` class, which is the recommended way to interface with the Google Gemini series of models. - -To use, install the requirements, and configure your environment. - -```bash -export GOOGLE_API_KEY=your-api-key -``` - -Then initialize - -```python -from langchain_google_genai import ChatGoogleGenerativeAI - -llm = ChatGoogleGenerativeAI(model="gemini-pro") -llm.invoke("Sing a ballad of LangChain.") -``` - -#### Multimodal inputs - -Gemini vision model supports image inputs when providing a single chat message. Example: - -``` -from langchain_core.messages import HumanMessage -from langchain_google_genai import ChatGoogleGenerativeAI - -llm = ChatGoogleGenerativeAI(model="gemini-pro-vision") -# example -message = HumanMessage( - content=[ - { - "type": "text", - "text": "What's in this image?", - }, # You can optionally provide text parts - {"type": "image_url", "image_url": "https://picsum.photos/seed/picsum/200/300"}, - ] -) -llm.invoke([message]) -``` - -The value of `image_url` can be any of the following: - -- A public image URL -- An accessible gcs file (e.g., "gcs://path/to/file.png") -- A local file path -- A base64 encoded image (e.g., `data:image/png;base64,abcd124`) -- A PIL image - - - -## Embeddings - -This package also adds support for google's embeddings models. - -``` -from langchain_google_genai import GoogleGenerativeAIEmbeddings - -embeddings = GoogleGenerativeAIEmbeddings(model="models/embedding-001") -embeddings.embed_query("hello, world!") -``` - -## Semantic Retrieval - -Enables retrieval augmented generation (RAG) in your application. - -``` -# Create a new store for housing your documents. -corpus_store = GoogleVectorStore.create_corpus(display_name="My Corpus") - -# Create a new document under the above corpus. -document_store = GoogleVectorStore.create_document( - corpus_id=corpus_store.corpus_id, display_name="My Document" -) - -# Upload some texts to the document. -text_splitter = CharacterTextSplitter(chunk_size=500, chunk_overlap=0) -for file in DirectoryLoader(path="data/").load(): - documents = text_splitter.split_documents([file]) - document_store.add_documents(documents) - -# Talk to your entire corpus with possibly many documents. -aqa = corpus_store.as_aqa() -answer = aqa.invoke("What is the meaning of life?") - -# Read the response along with the attributed passages and answerability. -print(response.answer) -print(response.attributed_passages) -print(response.answerable_probability) -```