diff --git a/.github/workflows/_release.yml b/.github/workflows/_release.yml index 38e882a7e7f45..5fa8ea2e50563 100644 --- a/.github/workflows/_release.yml +++ b/.github/workflows/_release.yml @@ -13,6 +13,11 @@ on: required: true type: string default: 'libs/langchain' + dangerous-nonmaster-release: + required: false + type: boolean + default: false + description: "Release from a non-master branch (danger!)" env: PYTHON_VERSION: "3.11" @@ -20,7 +25,7 @@ env: jobs: build: - if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/master' || inputs.dangerous-nonmaster-release environment: Scheduled testing runs-on: ubuntu-latest @@ -301,4 +306,4 @@ jobs: draft: false generateReleaseNotes: true tag: v${{ needs.build.outputs.version }} - commit: master + commit: ${{ github.sha }} diff --git a/docs/docs/integrations/platforms/google.mdx b/docs/docs/integrations/platforms/google.mdx index 0ac026261bfe5..b8936c064f0e1 100644 --- a/docs/docs/integrations/platforms/google.mdx +++ b/docs/docs/integrations/platforms/google.mdx @@ -163,16 +163,16 @@ from langchain_google_alloydb_pg import AlloyDBEngine, AlloyDBLoader > [Google Cloud BigQuery](https://cloud.google.com/bigquery) is a serverless and cost-effective enterprise data warehouse that works across clouds and scales with your data in Google Cloud. -We need to install `google-cloud-bigquery` python package. +We need to install `langchain-google-community` with Big Query dependencies: ```bash -pip install google-cloud-bigquery +pip install langchain-google-community[bigquery] ``` See a [usage example](/docs/integrations/document_loaders/google_bigquery). ```python -from langchain_community.document_loaders import BigQueryLoader +from langchain_google_community import BigQueryLoader ``` ### Bigtable @@ -239,10 +239,10 @@ from langchain_google_cloud_sql_pg import PostgresEngine, PostgresLoader >[Cloud Storage](https://en.wikipedia.org/wiki/Google_Cloud_Storage) is a managed service for storing unstructured data in Google Cloud. -We need to install `google-cloud-storage` python package. +We need to install `langchain-google-community` with Google Cloud Storage dependencies. ```bash -pip install google-cloud-storage +pip install langchain-google-community[gcs] ``` There are two loaders for the `Google Cloud Storage`: the `Directory` and the `File` loaders. @@ -250,12 +250,12 @@ There are two loaders for the `Google Cloud Storage`: the `Directory` and the `F See a [usage example](/docs/integrations/document_loaders/google_cloud_storage_directory). ```python -from langchain_community.document_loaders import GCSDirectoryLoader +from langchain_google_community import GCSDirectoryLoader ``` See a [usage example](/docs/integrations/document_loaders/google_cloud_storage_file). ```python -from langchain_community.document_loaders import GCSFileLoader +from langchain_google_community import GCSFileLoader ``` ### El Carro for Oracle Workloads @@ -280,16 +280,16 @@ from langchain_google_el_carro import ElCarroLoader Currently, only `Google Docs` are supported. -We need to install several python packages. +We need to install `langchain-google-community` with Google Drive dependencies. ```bash -pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib +pip install langchain-google-community[drive] ``` See a [usage example and authorization instructions](/docs/integrations/document_loaders/google_drive). ```python -from langchain_community.document_loaders import GoogleDriveLoader +from langchain_google_community import GoogleDriveLoader ``` ### Firestore (Native Mode) @@ -359,16 +359,16 @@ from langchain_google_spanner import SpannerLoader This document loader transcribes audio files and outputs the text results as Documents. -First, we need to install the python package. +First, we need to install `langchain-google-community` with speech-to-text dependencies. ```bash -pip install google-cloud-speech +pip install langchain-google-community[speech] ``` See a [usage example and authorization instructions](/docs/integrations/document_loaders/google_speech_to_text). ```python -from langchain_community.document_loaders import GoogleSpeechToTextLoader +from langchain_google_community import SpeechToTextLoader ``` ## Document Transformers @@ -386,15 +386,14 @@ We can get it either programmatically or copy from the `Prediction endpoint` sec tab in the Google Cloud Console. ```bash -pip install google-cloud-documentai -pip install google-cloud-documentai-toolbox +pip install langchain-google-community[docai] ``` See a [usage example](/docs/integrations/document_transformers/google_docai). ```python -from langchain_community.document_loaders.blob_loaders import Blob -from langchain_community.document_loaders.parsers import DocAIParser +from langchain_core.document_loaders.blob_loaders import Blob +from langchain_google_community import DocAIParser ``` ### Google Translate @@ -405,18 +404,16 @@ from langchain_community.document_loaders.parsers import DocAIParser The `GoogleTranslateTransformer` allows you to translate text and HTML with the [Google Cloud Translation API](https://cloud.google.com/translate). -To use it, you should have the `google-cloud-translate` python package installed, and a Google Cloud project with the [Translation API enabled](https://cloud.google.com/translate/docs/setup). This transformer uses the [Advanced edition (v3)](https://cloud.google.com/translate/docs/intro-to-v3). - -First, we need to install the python package. +First, we need to install the `langchain-google-community` with translate dependencies. ```bash -pip install google-cloud-translate +pip install langchain-google-community[translate] ``` See a [usage example and authorization instructions](/docs/integrations/document_transformers/google_translate). ```python -from langchain_community.document_transformers import GoogleTranslateTransformer +from langchain_google_community import GoogleTranslateTransformer ``` ## Vector Stores @@ -646,7 +643,7 @@ pip install google-cloud-text-to-speech See a [usage example and authorization instructions](/docs/integrations/tools/google_cloud_texttospeech). ```python -from langchain.tools import GoogleCloudTextToSpeechTool +from langchain_google_community import TextToSpeechTool ``` ### Google Drive @@ -739,7 +736,7 @@ from langchain_community.utilities.google_scholar import GoogleScholarAPIWrapper `GOOGLE_API_KEY` and `GOOGLE_CSE_ID` respectively. ```python -from langchain_community.utilities import GoogleSearchAPIWrapper +from langchain_google_community import GoogleSearchAPIWrapper ``` For a more detailed walkthrough of this wrapper, see [this notebook](/docs/integrations/tools/google_search). @@ -773,16 +770,16 @@ from langchain_community.utilities.google_trends import GoogleTrendsAPIWrapper > [Google Gmail](https://en.wikipedia.org/wiki/Gmail) is a free email service provided by Google. This toolkit works with emails through the `Gmail API`. -We need to install several python packages. +We need to install `langchain-google-community` with required dependencies: ```bash -pip install google-api-python-client google-auth-oauthlib google-auth-httplib2 +pip install langchain-google-community[gmail] ``` See a [usage example and authorization instructions](/docs/integrations/toolkits/gmail). ```python -from langchain_community.agent_toolkits import GmailToolkit +from langchain_google_community import GmailToolkit ``` ## Memory @@ -948,16 +945,16 @@ from langchain_google_el_carro import ElCarroChatMessageHistory > [Gmail](https://en.wikipedia.org/wiki/Gmail) is a free email service provided by Google. This loader works with emails through the `Gmail API`. -We need to install several python packages. +We need to install `langchain-google-community` with underlying dependencies. ```bash -pip install google-api-python-client google-auth-oauthlib google-auth-httplib2 +pip install langchain-google-community[gmail] ``` See a [usage example and authorization instructions](/docs/integrations/chat_loaders/gmail). ```python -from langchain_community.chat_loaders.gmail import GMailLoader +from langchain_google_community import GMailLoader ``` ## 3rd Party Integrations diff --git a/libs/langchain/langchain/chains/openai_functions/base.py b/libs/langchain/langchain/chains/openai_functions/base.py index 0d7e7cf189c24..1a4c269d60a64 100644 --- a/libs/langchain/langchain/chains/openai_functions/base.py +++ b/libs/langchain/langchain/chains/openai_functions/base.py @@ -34,7 +34,7 @@ __all__ = [ "get_openai_output_parser", "create_openai_fn_runnable", - "create_structured_output_runnable", + "create_structured_output_runnable", # deprecated "create_openai_fn_chain", # deprecated "create_structured_output_chain", # deprecated "PYTHON_TO_JSON_TYPES", # backwards compatibility @@ -144,7 +144,7 @@ class RecordDog(BaseModel): @deprecated( - since="0.1.1", removal="0.2.0", alternative="create_structured_output_runnable" + since="0.1.1", removal="0.2.0", alternative="ChatOpenAI.with_structured_output" ) def create_structured_output_chain( output_schema: Union[Dict[str, Any], Type[BaseModel]], diff --git a/libs/langchain/langchain/chains/structured_output/base.py b/libs/langchain/langchain/chains/structured_output/base.py index f26902ddf3834..524dd2d228dca 100644 --- a/libs/langchain/langchain/chains/structured_output/base.py +++ b/libs/langchain/langchain/chains/structured_output/base.py @@ -30,15 +30,15 @@ @deprecated( since="0.1.14", message=( - "LangChain has introduced a method called `with_structured_output` that" - "is available on ChatModels capable of tool calling." + "LangChain has introduced a method called `with_structured_output` that " + "is available on ChatModels capable of tool calling. " "You can read more about the method here: " - "https://python.langchain.com/docs/modules/model_io/chat/structured_output/" - "Please follow our extraction use case documentation for more guidelines" - "on how to do information extraction with LLMs." - "https://python.langchain.com/docs/use_cases/extraction/." + "https://python.langchain.com/docs/modules/model_io/chat/structured_output/ " + "Please follow our extraction use case documentation for more guidelines " + "on how to do information extraction with LLMs. " + "https://python.langchain.com/docs/use_cases/extraction/. " "If you notice other issues, please provide " - "feedback here:" + "feedback here: " "https://github.com/langchain-ai/langchain/discussions/18154" ), removal="0.3.0", @@ -146,6 +146,42 @@ class RecordDog(BaseModel): return llm.bind(**llm_kwargs_) | output_parser +@deprecated( + since="0.1.17", + message=( + "LangChain has introduced a method called `with_structured_output` that " + "is available on ChatModels capable of tool calling. " + "You can read more about the method here: " + "https://python.langchain.com/docs/modules/model_io/chat/structured_output/ " + "Please follow our extraction use case documentation for more guidelines " + "on how to do information extraction with LLMs. " + "https://python.langchain.com/docs/use_cases/extraction/. " + "If you notice other issues, please provide " + "feedback here: " + "https://github.com/langchain-ai/langchain/discussions/18154" + ), + removal="0.3.0", + pending=True, + alternative=( + """ + from langchain_core.pydantic_v1 import BaseModel, Field + from langchain_anthropic import ChatAnthropic + + class Joke(BaseModel): + setup: str = Field(description="The setup of the joke") + punchline: str = Field(description="The punchline to the joke") + + # Or any other chat model that supports tools. + # Please reference to to the documentation of structured_output + # to see an up to date list of which models support + # with_structured_output. + model = ChatAnthropic(model="claude-3-opus-20240229", temperature=0) + structured_llm = model.with_structured_output(Joke) + structured_llm.invoke("Tell me a joke about cats. + Make sure to call the Joke function.") + """ + ), +) def create_structured_output_runnable( output_schema: Union[Dict[str, Any], Type[BaseModel]], llm: Runnable,