Skip to content

Commit

Permalink
Merge branch 'master' into cc/retriever_score
Browse files Browse the repository at this point in the history
  • Loading branch information
ccurme committed Apr 26, 2024
2 parents bc7af5f + 078c5d9 commit 267ee9d
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 41 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ 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"
POETRY_VERSION: "1.7.1"

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

Expand Down Expand Up @@ -301,4 +306,4 @@ jobs:
draft: false
generateReleaseNotes: true
tag: v${{ needs.build.outputs.version }}
commit: master
commit: ${{ github.sha }}
57 changes: 27 additions & 30 deletions docs/docs/integrations/platforms/google.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -239,23 +239,23 @@ 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.

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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions libs/langchain/langchain/chains/openai_functions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]],
Expand Down
50 changes: 43 additions & 7 deletions libs/langchain/langchain/chains/structured_output/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 267ee9d

Please sign in to comment.