forked from Archives/langchain
Documentation fixes (linting and broken links) (#5563)
# Lint sphinx documentation and fix broken links This PR lints multiple warnings shown in generation of the project documentation (using "make docs_linkcheck" and "make docs_build"). Additionally documentation internal links to (now?) non-existent files are modified to point to existing documents as it seemed the new correct target. The documentation is not updated content wise. There are no source code changes. Fixes # (issue) - broken documentation links to other files within the project - sphinx formatting (linting) ## Before submitting No source code changes, so no new tests added. --------- Co-authored-by: Dev 2049 <dev.dev2049@gmail.com>
This commit is contained in:
parent
8441cff1d7
commit
001b147450
@ -9,8 +9,8 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"This notebook goes over adding memory to **both** of an Agent and its tools. Before going through this notebook, please walk through the following notebooks, as this will build on top of both of them:\n",
|
"This notebook goes over adding memory to **both** of an Agent and its tools. Before going through this notebook, please walk through the following notebooks, as this will build on top of both of them:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"- [Adding memory to an LLM Chain](../../memory/examples/adding_memory.ipynb)\n",
|
"- [Adding memory to an LLM Chain](../../../memory/examples/adding_memory.ipynb)\n",
|
||||||
"- [Custom Agents](custom_agent.ipynb)\n",
|
"- [Custom Agents](../../agents/custom_agent.ipynb)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"We are going to create a custom Agent. The agent has access to a conversation memory, search tool, and a summarization tool. And, the summarization tool also needs access to the conversation memory."
|
"We are going to create a custom Agent. The agent has access to a conversation memory, search tool, and a summarization tool. And, the summarization tool also needs access to the conversation memory."
|
||||||
]
|
]
|
||||||
|
@ -36,7 +36,7 @@ The first category of how-to guides here cover specific parts of working with ag
|
|||||||
:glob:
|
:glob:
|
||||||
:hidden:
|
:hidden:
|
||||||
|
|
||||||
./examples/*
|
./agents/examples/*
|
||||||
|
|
||||||
|
|
||||||
Agent Toolkits
|
Agent Toolkits
|
||||||
@ -46,26 +46,26 @@ The next set of examples covers agents with toolkits.
|
|||||||
As opposed to the examples above, these examples are not intended to show off an agent `type`,
|
As opposed to the examples above, these examples are not intended to show off an agent `type`,
|
||||||
but rather to show off an agent applied to particular use case.
|
but rather to show off an agent applied to particular use case.
|
||||||
|
|
||||||
`SQLDatabase Agent <./agent_toolkits/sql_database.html>`_: This notebook covers how to interact with an arbitrary SQL database using an agent.
|
`SQLDatabase Agent <./toolkits/sql_database.html>`_: This notebook covers how to interact with an arbitrary SQL database using an agent.
|
||||||
|
|
||||||
`JSON Agent <./agent_toolkits/json.html>`_: This notebook covers how to interact with a JSON dictionary using an agent.
|
`JSON Agent <./toolkits/json.html>`_: This notebook covers how to interact with a JSON dictionary using an agent.
|
||||||
|
|
||||||
`OpenAPI Agent <./agent_toolkits/openapi.html>`_: This notebook covers how to interact with an arbitrary OpenAPI endpoint using an agent.
|
`OpenAPI Agent <./toolkits/openapi.html>`_: This notebook covers how to interact with an arbitrary OpenAPI endpoint using an agent.
|
||||||
|
|
||||||
`VectorStore Agent <./agent_toolkits/vectorstore.html>`_: This notebook covers how to interact with VectorStores using an agent.
|
`VectorStore Agent <./toolkits/vectorstore.html>`_: This notebook covers how to interact with VectorStores using an agent.
|
||||||
|
|
||||||
`Python Agent <./agent_toolkits/python.html>`_: This notebook covers how to produce and execute python code using an agent.
|
`Python Agent <./toolkits/python.html>`_: This notebook covers how to produce and execute python code using an agent.
|
||||||
|
|
||||||
`Pandas DataFrame Agent <./agent_toolkits/pandas.html>`_: This notebook covers how to do question answering over a pandas dataframe using an agent. Under the hood this calls the Python agent..
|
`Pandas DataFrame Agent <./toolkits/pandas.html>`_: This notebook covers how to do question answering over a pandas dataframe using an agent. Under the hood this calls the Python agent..
|
||||||
|
|
||||||
`CSV Agent <./agent_toolkits/csv.html>`_: This notebook covers how to do question answering over a csv file. Under the hood this calls the Pandas DataFrame agent.
|
`CSV Agent <./toolkits/csv.html>`_: This notebook covers how to do question answering over a csv file. Under the hood this calls the Pandas DataFrame agent.
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
:glob:
|
:glob:
|
||||||
:hidden:
|
:hidden:
|
||||||
|
|
||||||
./agent_toolkits/*
|
./toolkits/*
|
||||||
|
|
||||||
|
|
||||||
Agent Types
|
Agent Types
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"LangChain provides async support for Chains by leveraging the [asyncio](https://docs.python.org/3/library/asyncio.html) library.\n",
|
"LangChain provides async support for Chains by leveraging the [asyncio](https://docs.python.org/3/library/asyncio.html) library.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Async methods are currently supported in `LLMChain` (through `arun`, `apredict`, `acall`) and `LLMMathChain` (through `arun` and `acall`), `ChatVectorDBChain`, and [QA chains](../indexes/chain_examples/question_answering.html). Async support for other chains is on the roadmap."
|
"Async methods are currently supported in `LLMChain` (through `arun`, `apredict`, `acall`) and `LLMMathChain` (through `arun` and `acall`), `ChatVectorDBChain`, and [QA chains](../index_examples/question_answering.ipynb). Async support for other chains is on the roadmap."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -104,7 +104,7 @@
|
|||||||
"s = time.perf_counter()\n",
|
"s = time.perf_counter()\n",
|
||||||
"generate_serially()\n",
|
"generate_serially()\n",
|
||||||
"elapsed = time.perf_counter() - s\n",
|
"elapsed = time.perf_counter() - s\n",
|
||||||
"print('\\033[1m' + f\"Serial executed in {elapsed:0.2f} seconds.\" + '\\033[0m')"
|
"print('\\033[1m' + f\"Serial executed in {elapsed:0.2f} seconds.\" + '\\033[0m')\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -88,7 +88,7 @@ We don't need any access permissions to these datasets and services.
|
|||||||
|
|
||||||
|
|
||||||
Proprietary dataset or service loaders
|
Proprietary dataset or service loaders
|
||||||
------------------------------
|
--------------------------------------
|
||||||
These datasets and services are not from the public domain.
|
These datasets and services are not from the public domain.
|
||||||
These loaders mostly transform data from specific formats of applications or cloud services,
|
These loaders mostly transform data from specific formats of applications or cloud services,
|
||||||
for example **Google Drive**.
|
for example **Google Drive**.
|
||||||
|
@ -137,7 +137,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!poetry run pip -q install openai tiktoken chromadb "
|
"!poetry run pip -q install openai tiktoken chromadb"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -317,7 +317,7 @@
|
|||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"We can use a [self-querying retriever](../../retrievers/examples/self_query_retriever.ipynb) to improve our query accuracy, using this additional metadata:"
|
"We can use a [self-querying retriever](../../retrievers/examples/self_query.ipynb) to improve our query accuracy, using this additional metadata:"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"This notebook goes over adding memory to an Agent. Before going through this notebook, please walkthrough the following notebooks, as this will build on top of both of them:\n",
|
"This notebook goes over adding memory to an Agent. Before going through this notebook, please walkthrough the following notebooks, as this will build on top of both of them:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"- [Adding memory to an LLM Chain](adding_memory.ipynb)\n",
|
"- [Adding memory to an LLM Chain](adding_memory.ipynb)\n",
|
||||||
"- [Custom Agents](../../agents/examples/custom_agent.ipynb)\n",
|
"- [Custom Agents](../../agents/agents/custom_agent.ipynb)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"In order to add a memory to an agent we are going to the the following steps:\n",
|
"In order to add a memory to an agent we are going to the the following steps:\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
"This notebook goes over adding memory to an Agent where the memory uses an external message store. Before going through this notebook, please walkthrough the following notebooks, as this will build on top of both of them:\n",
|
"This notebook goes over adding memory to an Agent where the memory uses an external message store. Before going through this notebook, please walkthrough the following notebooks, as this will build on top of both of them:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"- [Adding memory to an LLM Chain](adding_memory.ipynb)\n",
|
"- [Adding memory to an LLM Chain](adding_memory.ipynb)\n",
|
||||||
"- [Custom Agents](../../agents/examples/custom_agent.ipynb)\n",
|
"- [Custom Agents](../../agents/agents/custom_agent.ipynb)\n",
|
||||||
"- [Agent with Memory](agetn_with_memory.ipynb)\n",
|
"- [Agent with Memory](agent_with_memory.ipynb)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"In order to add a memory with an external message store to an agent we are going to do the following steps:\n",
|
"In order to add a memory with an external message store to an agent we are going to do the following steps:\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
==========
|
====================
|
||||||
Experimental Modules
|
Experimental Modules
|
||||||
==========
|
====================
|
||||||
|
|
||||||
This module contains experimental modules and reproductions of existing work using LangChain primitives.
|
This module contains experimental modules and reproductions of existing work using LangChain primitives.
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ class ChatAnthropic(BaseChatModel, _AnthropicCommon):
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
import anthropic
|
import anthropic
|
||||||
from langchain.llms import Anthropic
|
from langchain.llms import Anthropic
|
||||||
model = ChatAnthropic(model="<model_name>", anthropic_api_key="my-api-key")
|
model = ChatAnthropic(model="<model_name>", anthropic_api_key="my-api-key")
|
||||||
|
@ -30,6 +30,7 @@ class AzureChatOpenAI(ChatOpenAI):
|
|||||||
`35-turbo-dev`, the constructor should look like:
|
`35-turbo-dev`, the constructor should look like:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
AzureChatOpenAI(
|
AzureChatOpenAI(
|
||||||
deployment_name="35-turbo-dev",
|
deployment_name="35-turbo-dev",
|
||||||
openai_api_version="2023-03-15-preview",
|
openai_api_version="2023-03-15-preview",
|
||||||
|
@ -20,6 +20,7 @@ class PromptLayerChatOpenAI(ChatOpenAI):
|
|||||||
|
|
||||||
All parameters that can be passed to the OpenAI LLM can also
|
All parameters that can be passed to the OpenAI LLM can also
|
||||||
be passed here. The PromptLayerChatOpenAI adds to optional
|
be passed here. The PromptLayerChatOpenAI adds to optional
|
||||||
|
|
||||||
parameters:
|
parameters:
|
||||||
``pl_tags``: List of strings to tag the request with.
|
``pl_tags``: List of strings to tag the request with.
|
||||||
``return_pl_id``: If True, the PromptLayer request ID will be
|
``return_pl_id``: If True, the PromptLayer request ID will be
|
||||||
|
@ -149,6 +149,7 @@ class AlephAlphaSymmetricSemanticEmbedding(AlephAlphaAsymmetricSemanticEmbedding
|
|||||||
queries are embedded with a SemanticRepresentation.Symmetric
|
queries are embedded with a SemanticRepresentation.Symmetric
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from aleph_alpha import AlephAlphaSymmetricSemanticEmbedding
|
from aleph_alpha import AlephAlphaSymmetricSemanticEmbedding
|
||||||
|
|
||||||
embeddings = AlephAlphaAsymmetricSemanticEmbedding()
|
embeddings = AlephAlphaAsymmetricSemanticEmbedding()
|
||||||
|
@ -66,30 +66,32 @@ class ElasticsearchEmbeddings(Embeddings):
|
|||||||
es_user: (str, optional): Elasticsearch username.
|
es_user: (str, optional): Elasticsearch username.
|
||||||
es_password: (str, optional): Elasticsearch password.
|
es_password: (str, optional): Elasticsearch password.
|
||||||
|
|
||||||
Example Usage:
|
Example:
|
||||||
from langchain.embeddings import ElasticsearchEmbeddings
|
.. code-block:: python
|
||||||
|
|
||||||
# Define the model ID and input field name (if different from default)
|
from langchain.embeddings import ElasticsearchEmbeddings
|
||||||
model_id = "your_model_id"
|
|
||||||
# Optional, only if different from 'text_field'
|
|
||||||
input_field = "your_input_field"
|
|
||||||
|
|
||||||
# Credentials can be passed in two ways. Either set the env vars
|
# Define the model ID and input field name (if different from default)
|
||||||
# ES_CLOUD_ID, ES_USER, ES_PASSWORD and they will be automatically pulled
|
model_id = "your_model_id"
|
||||||
# in, or pass them in directly as kwargs.
|
# Optional, only if different from 'text_field'
|
||||||
embeddings = ElasticsearchEmbeddings.from_credentials(
|
input_field = "your_input_field"
|
||||||
model_id,
|
|
||||||
input_field=input_field,
|
|
||||||
# es_cloud_id="foo",
|
|
||||||
# es_user="bar",
|
|
||||||
# es_password="baz",
|
|
||||||
)
|
|
||||||
|
|
||||||
documents = [
|
# Credentials can be passed in two ways. Either set the env vars
|
||||||
"This is an example document.",
|
# ES_CLOUD_ID, ES_USER, ES_PASSWORD and they will be automatically
|
||||||
"Another example document to generate embeddings for.",
|
# pulled in, or pass them in directly as kwargs.
|
||||||
]
|
embeddings = ElasticsearchEmbeddings.from_credentials(
|
||||||
embeddings_generator.embed_documents(documents)
|
model_id,
|
||||||
|
input_field=input_field,
|
||||||
|
# es_cloud_id="foo",
|
||||||
|
# es_user="bar",
|
||||||
|
# es_password="baz",
|
||||||
|
)
|
||||||
|
|
||||||
|
documents = [
|
||||||
|
"This is an example document.",
|
||||||
|
"Another example document to generate embeddings for.",
|
||||||
|
]
|
||||||
|
embeddings_generator.embed_documents(documents)
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
from elasticsearch import Elasticsearch
|
from elasticsearch import Elasticsearch
|
||||||
@ -135,32 +137,35 @@ class ElasticsearchEmbeddings(Embeddings):
|
|||||||
Returns:
|
Returns:
|
||||||
ElasticsearchEmbeddings: An instance of the ElasticsearchEmbeddings class.
|
ElasticsearchEmbeddings: An instance of the ElasticsearchEmbeddings class.
|
||||||
|
|
||||||
Example Usage:
|
Example:
|
||||||
from elasticsearch import Elasticsearch
|
.. code-block:: python
|
||||||
from langchain.embeddings import ElasticsearchEmbeddings
|
|
||||||
|
|
||||||
# Define the model ID and input field name (if different from default)
|
from elasticsearch import Elasticsearch
|
||||||
model_id = "your_model_id"
|
|
||||||
# Optional, only if different from 'text_field'
|
|
||||||
input_field = "your_input_field"
|
|
||||||
|
|
||||||
# Create Elasticsearch connection
|
from langchain.embeddings import ElasticsearchEmbeddings
|
||||||
es_connection = Elasticsearch(
|
|
||||||
hosts=["localhost:9200"], http_auth=("user", "password")
|
|
||||||
)
|
|
||||||
|
|
||||||
# Instantiate ElasticsearchEmbeddings using the existing connection
|
# Define the model ID and input field name (if different from default)
|
||||||
embeddings = ElasticsearchEmbeddings.from_es_connection(
|
model_id = "your_model_id"
|
||||||
model_id,
|
# Optional, only if different from 'text_field'
|
||||||
es_connection,
|
input_field = "your_input_field"
|
||||||
input_field=input_field,
|
|
||||||
)
|
|
||||||
|
|
||||||
documents = [
|
# Create Elasticsearch connection
|
||||||
"This is an example document.",
|
es_connection = Elasticsearch(
|
||||||
"Another example document to generate embeddings for.",
|
hosts=["localhost:9200"], http_auth=("user", "password")
|
||||||
]
|
)
|
||||||
embeddings_generator.embed_documents(documents)
|
|
||||||
|
# Instantiate ElasticsearchEmbeddings using the existing connection
|
||||||
|
embeddings = ElasticsearchEmbeddings.from_es_connection(
|
||||||
|
model_id,
|
||||||
|
es_connection,
|
||||||
|
input_field=input_field,
|
||||||
|
)
|
||||||
|
|
||||||
|
documents = [
|
||||||
|
"This is an example document.",
|
||||||
|
"Another example document to generate embeddings for.",
|
||||||
|
]
|
||||||
|
embeddings_generator.embed_documents(documents)
|
||||||
"""
|
"""
|
||||||
# Importing MlClient from elasticsearch.client within the method to
|
# Importing MlClient from elasticsearch.client within the method to
|
||||||
# avoid unnecessary import if the method is not used
|
# avoid unnecessary import if the method is not used
|
||||||
|
@ -107,6 +107,7 @@ class Anthropic(LLM, _AnthropicCommon):
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
import anthropic
|
import anthropic
|
||||||
from langchain.llms import Anthropic
|
from langchain.llms import Anthropic
|
||||||
model = Anthropic(model="<model_name>", anthropic_api_key="my-api-key")
|
model = Anthropic(model="<model_name>", anthropic_api_key="my-api-key")
|
||||||
|
@ -18,6 +18,7 @@ class Anyscale(LLM):
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from langchain.llms import Anyscale
|
from langchain.llms import Anyscale
|
||||||
anyscale = Anyscale(anyscale_service_url="SERVICE_URL",
|
anyscale = Anyscale(anyscale_service_url="SERVICE_URL",
|
||||||
anyscale_service_route="SERVICE_ROUTE",
|
anyscale_service_route="SERVICE_ROUTE",
|
||||||
|
@ -23,6 +23,7 @@ class Banana(LLM):
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from langchain.llms import Banana
|
from langchain.llms import Banana
|
||||||
banana = Banana(model_key="")
|
banana = Banana(model_key="")
|
||||||
"""
|
"""
|
||||||
|
@ -31,24 +31,28 @@ class Beam(LLM):
|
|||||||
The wrapper can then be called as follows, where the name, cpu, memory, gpu,
|
The wrapper can then be called as follows, where the name, cpu, memory, gpu,
|
||||||
python version, and python packages can be updated accordingly. Once deployed,
|
python version, and python packages can be updated accordingly. Once deployed,
|
||||||
the instance can be called.
|
the instance can be called.
|
||||||
llm = Beam(model_name="gpt2",
|
|
||||||
name="langchain-gpt2",
|
|
||||||
cpu=8,
|
|
||||||
memory="32Gi",
|
|
||||||
gpu="A10G",
|
|
||||||
python_version="python3.8",
|
|
||||||
python_packages=[
|
|
||||||
"diffusers[torch]>=0.10",
|
|
||||||
"transformers",
|
|
||||||
"torch",
|
|
||||||
"pillow",
|
|
||||||
"accelerate",
|
|
||||||
"safetensors",
|
|
||||||
"xformers",],
|
|
||||||
max_length=50)
|
|
||||||
|
|
||||||
llm._deploy()
|
Example:
|
||||||
call_result = llm._call(input)
|
.. code-block:: python
|
||||||
|
|
||||||
|
llm = Beam(model_name="gpt2",
|
||||||
|
name="langchain-gpt2",
|
||||||
|
cpu=8,
|
||||||
|
memory="32Gi",
|
||||||
|
gpu="A10G",
|
||||||
|
python_version="python3.8",
|
||||||
|
python_packages=[
|
||||||
|
"diffusers[torch]>=0.10",
|
||||||
|
"transformers",
|
||||||
|
"torch",
|
||||||
|
"pillow",
|
||||||
|
"accelerate",
|
||||||
|
"safetensors",
|
||||||
|
"xformers",],
|
||||||
|
max_length=50)
|
||||||
|
llm._deploy()
|
||||||
|
call_result = llm._call(input)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
model_name: str = ""
|
model_name: str = ""
|
||||||
|
@ -23,6 +23,7 @@ class CerebriumAI(LLM):
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from langchain.llms import CerebriumAI
|
from langchain.llms import CerebriumAI
|
||||||
cerebrium = CerebriumAI(endpoint_url="")
|
cerebrium = CerebriumAI(endpoint_url="")
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ class GooseAI(LLM):
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from langchain.llms import GooseAI
|
from langchain.llms import GooseAI
|
||||||
gooseai = GooseAI(model_name="gpt-neo-20b")
|
gooseai = GooseAI(model_name="gpt-neo-20b")
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ class LlamaCpp(LLM):
|
|||||||
|
|
||||||
def _get_parameters(self, stop: Optional[List[str]] = None) -> Dict[str, Any]:
|
def _get_parameters(self, stop: Optional[List[str]] = None) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
Performs sanity check, preparing paramaters in format needed by llama_cpp.
|
Performs sanity check, preparing parameters in format needed by llama_cpp.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
stop (Optional[List[str]]): List of stop sequences for llama_cpp.
|
stop (Optional[List[str]]): List of stop sequences for llama_cpp.
|
||||||
@ -238,7 +238,7 @@ class LlamaCpp(LLM):
|
|||||||
) -> Generator[Dict, None, None]:
|
) -> Generator[Dict, None, None]:
|
||||||
"""Yields results objects as they are generated in real time.
|
"""Yields results objects as they are generated in real time.
|
||||||
|
|
||||||
BETA: this is a beta feature while we figure out the right abstraction:
|
BETA: this is a beta feature while we figure out the right abstraction.
|
||||||
Once that happens, this interface could change.
|
Once that happens, this interface could change.
|
||||||
|
|
||||||
It also calls the callback manager's on_llm_new_token event with
|
It also calls the callback manager's on_llm_new_token event with
|
||||||
|
@ -22,6 +22,7 @@ class Modal(LLM):
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from langchain.llms import Modal
|
from langchain.llms import Modal
|
||||||
modal = Modal(endpoint_url="")
|
modal = Modal(endpoint_url="")
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ class Petals(LLM):
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from langchain.llms import petals
|
from langchain.llms import petals
|
||||||
petals = Petals()
|
petals = Petals()
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ class PipelineAI(LLM, BaseModel):
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from langchain import PipelineAI
|
from langchain import PipelineAI
|
||||||
pipeline = PipelineAI(pipeline_key="")
|
pipeline = PipelineAI(pipeline_key="")
|
||||||
"""
|
"""
|
||||||
|
@ -19,8 +19,10 @@ class PredictionGuard(LLM):
|
|||||||
it as a named parameter to the constructor. To use Prediction Guard's API along
|
it as a named parameter to the constructor. To use Prediction Guard's API along
|
||||||
with OpenAI models, set the environment variable ``OPENAI_API_KEY`` with your
|
with OpenAI models, set the environment variable ``OPENAI_API_KEY`` with your
|
||||||
OpenAI API key as well.
|
OpenAI API key as well.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
pgllm = PredictionGuard(model="MPT-7B-Instruct",
|
pgllm = PredictionGuard(model="MPT-7B-Instruct",
|
||||||
token="my-access-token",
|
token="my-access-token",
|
||||||
output={
|
output={
|
||||||
|
@ -20,6 +20,7 @@ class PromptLayerOpenAI(OpenAI):
|
|||||||
|
|
||||||
All parameters that can be passed to the OpenAI LLM can also
|
All parameters that can be passed to the OpenAI LLM can also
|
||||||
be passed here. The PromptLayerOpenAI LLM adds two optional
|
be passed here. The PromptLayerOpenAI LLM adds two optional
|
||||||
|
|
||||||
parameters:
|
parameters:
|
||||||
``pl_tags``: List of strings to tag the request with.
|
``pl_tags``: List of strings to tag the request with.
|
||||||
``return_pl_id``: If True, the PromptLayer request ID will be
|
``return_pl_id``: If True, the PromptLayer request ID will be
|
||||||
@ -124,6 +125,7 @@ class PromptLayerOpenAIChat(OpenAIChat):
|
|||||||
|
|
||||||
All parameters that can be passed to the OpenAIChat LLM can also
|
All parameters that can be passed to the OpenAIChat LLM can also
|
||||||
be passed here. The PromptLayerOpenAIChat adds two optional
|
be passed here. The PromptLayerOpenAIChat adds two optional
|
||||||
|
|
||||||
parameters:
|
parameters:
|
||||||
``pl_tags``: List of strings to tag the request with.
|
``pl_tags``: List of strings to tag the request with.
|
||||||
``return_pl_id``: If True, the PromptLayer request ID will be
|
``return_pl_id``: If True, the PromptLayer request ID will be
|
||||||
|
@ -23,6 +23,7 @@ class Replicate(LLM):
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from langchain.llms import Replicate
|
from langchain.llms import Replicate
|
||||||
replicate = Replicate(model="stability-ai/stable-diffusion: \
|
replicate = Replicate(model="stability-ai/stable-diffusion: \
|
||||||
27b93a2413e7f36cd83da926f365628\
|
27b93a2413e7f36cd83da926f365628\
|
||||||
|
@ -20,6 +20,7 @@ DEFAULT_PORT = 9042
|
|||||||
|
|
||||||
class CassandraChatMessageHistory(BaseChatMessageHistory):
|
class CassandraChatMessageHistory(BaseChatMessageHistory):
|
||||||
"""Chat message history that stores history in Cassandra.
|
"""Chat message history that stores history in Cassandra.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
contact_points: list of ips to connect to Cassandra cluster
|
contact_points: list of ips to connect to Cassandra cluster
|
||||||
session_id: arbitrary key that is used to store the messages
|
session_id: arbitrary key that is used to store the messages
|
||||||
|
@ -27,7 +27,7 @@ This quick start will focus on the server-side use case for brevity.
|
|||||||
Review [full docs](https://nla.zapier.com/api/v1/docs) or reach out to
|
Review [full docs](https://nla.zapier.com/api/v1/docs) or reach out to
|
||||||
nla@zapier.com for user-facing oauth developer support.
|
nla@zapier.com for user-facing oauth developer support.
|
||||||
|
|
||||||
Typically you'd use SequentialChain, here's a basic example:
|
Typically, you'd use SequentialChain, here's a basic example:
|
||||||
|
|
||||||
1. Use NLA to find an email in Gmail
|
1. Use NLA to find an email in Gmail
|
||||||
2. Use LLMChain to generate a draft reply to (1)
|
2. Use LLMChain to generate a draft reply to (1)
|
||||||
@ -100,6 +100,7 @@ class ZapierNLARunAction(BaseTool):
|
|||||||
params: a dict, optional. Any params provided will *override* AI guesses
|
params: a dict, optional. Any params provided will *override* AI guesses
|
||||||
from `instructions` (see "understanding the AI guessing flow" here:
|
from `instructions` (see "understanding the AI guessing flow" here:
|
||||||
https://nla.zapier.com/api/v1/docs)
|
https://nla.zapier.com/api/v1/docs)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
api_wrapper: ZapierNLAWrapper = Field(default_factory=ZapierNLAWrapper)
|
api_wrapper: ZapierNLAWrapper = Field(default_factory=ZapierNLAWrapper)
|
||||||
@ -160,6 +161,7 @@ class ZapierNLAListActions(BaseTool):
|
|||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
None
|
None
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
name = "Zapier NLA: List Actions"
|
name = "Zapier NLA: List Actions"
|
||||||
|
@ -29,6 +29,7 @@ class ArxivAPIWrapper(BaseModel):
|
|||||||
if True: the `metadata` of the loaded Documents gets all available meta info
|
if True: the `metadata` of the loaded Documents gets all available meta info
|
||||||
(see https://lukasschwab.me/arxiv.py/index.html#Result),
|
(see https://lukasschwab.me/arxiv.py/index.html#Result),
|
||||||
if False: the `metadata` gets only the most informative fields.
|
if False: the `metadata` gets only the most informative fields.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
arxiv_client: Any #: :meta private:
|
arxiv_client: Any #: :meta private:
|
||||||
|
@ -33,7 +33,7 @@ class GoogleSearchAPIWrapper(BaseModel):
|
|||||||
- That’s all you have to fill up, the rest doesn’t matter.
|
- That’s all you have to fill up, the rest doesn’t matter.
|
||||||
In the left-side menu, click Edit search engine → {your search engine name}
|
In the left-side menu, click Edit search engine → {your search engine name}
|
||||||
→ Setup Set Search the entire web to ON. Remove the URL you added from
|
→ Setup Set Search the entire web to ON. Remove the URL you added from
|
||||||
the list of Sites to search.
|
the list of Sites to search.
|
||||||
- Under Search engine ID you’ll find the search-engine-ID.
|
- Under Search engine ID you’ll find the search-engine-ID.
|
||||||
|
|
||||||
4. Enable the Custom Search API
|
4. Enable the Custom Search API
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
SearxNG is a privacy-friendly free metasearch engine that aggregates results from
|
SearxNG is a privacy-friendly free metasearch engine that aggregates results from
|
||||||
`multiple search engines
|
`multiple search engines
|
||||||
<https://docs.searxng.org/admin/engines/configured_engines.html>`_ and databases and
|
<https://docs.searxng.org/admin/engines/configured_engines.html>`_ and databases and
|
||||||
supports the `OpenSearch
|
supports the `OpenSearch
|
||||||
<https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md>`_
|
<https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md>`_
|
||||||
specification.
|
specification.
|
||||||
|
|
||||||
More detailes on the installtion instructions `here. <../../integrations/searx.html>`_
|
More details on the installation instructions `here. <../../integrations/searx.html>`_
|
||||||
|
|
||||||
For the search API refer to https://docs.searxng.org/dev/search_api.html
|
For the search API refer to https://docs.searxng.org/dev/search_api.html
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ Searching
|
|||||||
|
|
||||||
Use the :meth:`run() <SearxSearchWrapper.run>` and
|
Use the :meth:`run() <SearxSearchWrapper.run>` and
|
||||||
:meth:`results() <SearxSearchWrapper.results>` methods to query the searx API.
|
:meth:`results() <SearxSearchWrapper.results>` methods to query the searx API.
|
||||||
Other methods are are available for convenience.
|
Other methods are available for convenience.
|
||||||
|
|
||||||
:class:`SearxResults` is a convenience wrapper around the raw json result.
|
:class:`SearxResults` is a convenience wrapper around the raw json result.
|
||||||
|
|
||||||
@ -415,33 +415,22 @@ class SearxSearchWrapper(BaseModel):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
query: The query to search for.
|
query: The query to search for.
|
||||||
|
|
||||||
query_suffix: Extra suffix appended to the query.
|
query_suffix: Extra suffix appended to the query.
|
||||||
|
|
||||||
num_results: Limit the number of results to return.
|
num_results: Limit the number of results to return.
|
||||||
|
|
||||||
engines: List of engines to use for the query.
|
engines: List of engines to use for the query.
|
||||||
|
|
||||||
categories: List of categories to use for the query.
|
categories: List of categories to use for the query.
|
||||||
|
|
||||||
**kwargs: extra parameters to pass to the searx API.
|
**kwargs: extra parameters to pass to the searx API.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Dict with the following keys:
|
Dict with the following keys:
|
||||||
|
|
||||||
{
|
{
|
||||||
snippet: The description of the result.
|
snippet: The description of the result.
|
||||||
|
|
||||||
title: The title of the result.
|
title: The title of the result.
|
||||||
|
|
||||||
link: The link to the result.
|
link: The link to the result.
|
||||||
|
|
||||||
engines: The engines used for the result.
|
engines: The engines used for the result.
|
||||||
|
|
||||||
category: Searx category of the result.
|
category: Searx category of the result.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
_params = {
|
_params = {
|
||||||
"q": query,
|
"q": query,
|
||||||
|
@ -121,6 +121,7 @@ class AnalyticDB(VectorStore):
|
|||||||
- `pre_delete_collection` if True, will delete the collection if it exists.
|
- `pre_delete_collection` if True, will delete the collection if it exists.
|
||||||
(default: False)
|
(default: False)
|
||||||
- Useful for testing.
|
- Useful for testing.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -52,7 +52,6 @@ class VectorStore(ABC):
|
|||||||
Args:
|
Args:
|
||||||
documents (List[Document]: Documents to add to the vectorstore.
|
documents (List[Document]: Documents to add to the vectorstore.
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
List[str]: List of IDs of the added texts.
|
List[str]: List of IDs of the added texts.
|
||||||
"""
|
"""
|
||||||
|
@ -244,6 +244,7 @@ class Chroma(VectorStore):
|
|||||||
"""Return docs selected using the maximal marginal relevance.
|
"""Return docs selected using the maximal marginal relevance.
|
||||||
Maximal marginal relevance optimizes for similarity to query AND diversity
|
Maximal marginal relevance optimizes for similarity to query AND diversity
|
||||||
among selected documents.
|
among selected documents.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
embedding: Embedding to look up documents similar to.
|
embedding: Embedding to look up documents similar to.
|
||||||
k: Number of Documents to return. Defaults to 4.
|
k: Number of Documents to return. Defaults to 4.
|
||||||
@ -253,6 +254,7 @@ class Chroma(VectorStore):
|
|||||||
to maximum diversity and 1 to minimum diversity.
|
to maximum diversity and 1 to minimum diversity.
|
||||||
Defaults to 0.5.
|
Defaults to 0.5.
|
||||||
filter (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.
|
filter (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
List of Documents selected by maximal marginal relevance.
|
List of Documents selected by maximal marginal relevance.
|
||||||
"""
|
"""
|
||||||
@ -287,6 +289,7 @@ class Chroma(VectorStore):
|
|||||||
"""Return docs selected using the maximal marginal relevance.
|
"""Return docs selected using the maximal marginal relevance.
|
||||||
Maximal marginal relevance optimizes for similarity to query AND diversity
|
Maximal marginal relevance optimizes for similarity to query AND diversity
|
||||||
among selected documents.
|
among selected documents.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
query: Text to look up documents similar to.
|
query: Text to look up documents similar to.
|
||||||
k: Number of Documents to return. Defaults to 4.
|
k: Number of Documents to return. Defaults to 4.
|
||||||
@ -296,6 +299,7 @@ class Chroma(VectorStore):
|
|||||||
to maximum diversity and 1 to minimum diversity.
|
to maximum diversity and 1 to minimum diversity.
|
||||||
Defaults to 0.5.
|
Defaults to 0.5.
|
||||||
filter (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.
|
filter (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
List of Documents selected by maximal marginal relevance.
|
List of Documents selected by maximal marginal relevance.
|
||||||
"""
|
"""
|
||||||
|
@ -391,6 +391,7 @@ class DeepLake(VectorStore):
|
|||||||
Args:
|
Args:
|
||||||
embedding: Embedding to look up documents similar to.
|
embedding: Embedding to look up documents similar to.
|
||||||
k: Number of Documents to return. Defaults to 4.
|
k: Number of Documents to return. Defaults to 4.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
List of Documents most similar to the query vector.
|
List of Documents most similar to the query vector.
|
||||||
"""
|
"""
|
||||||
@ -412,6 +413,7 @@ class DeepLake(VectorStore):
|
|||||||
Defaults to `L2`.
|
Defaults to `L2`.
|
||||||
k (int): Number of results to return. Defaults to 4.
|
k (int): Number of results to return. Defaults to 4.
|
||||||
filter (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.
|
filter (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
List[Tuple[Document, float]]: List of documents most similar to the query
|
List[Tuple[Document, float]]: List of documents most similar to the query
|
||||||
text with distance in float.
|
text with distance in float.
|
||||||
@ -435,14 +437,16 @@ class DeepLake(VectorStore):
|
|||||||
"""Return docs selected using the maximal marginal relevance.
|
"""Return docs selected using the maximal marginal relevance.
|
||||||
Maximal marginal relevance optimizes for similarity to query AND diversity
|
Maximal marginal relevance optimizes for similarity to query AND diversity
|
||||||
among selected documents.
|
among selected documents.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
embedding: Embedding to look up documents similar to.
|
embedding: Embedding to look up documents similar to.
|
||||||
k: Number of Documents to return. Defaults to 4.
|
k: Number of Documents to return. Defaults to 4.
|
||||||
fetch_k: Number of Documents to fetch to pass to MMR algorithm.
|
fetch_k: Number of Documents to fetch to pass to MMR algorithm.
|
||||||
lambda_mult: Number between 0 and 1 that determines the degree
|
lambda_mult: Number between 0 and 1 that determines the degree
|
||||||
of diversity among the results with 0 corresponding
|
of diversity among the results with 0 corresponding
|
||||||
to maximum diversity and 1 to minimum diversity.
|
to maximum diversity and 1 to minimum diversity.
|
||||||
Defaults to 0.5.
|
Defaults to 0.5.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
List of Documents selected by maximal marginal relevance.
|
List of Documents selected by maximal marginal relevance.
|
||||||
"""
|
"""
|
||||||
@ -514,7 +518,7 @@ class DeepLake(VectorStore):
|
|||||||
- AWS S3 path of the form ``s3://bucketname/path/to/dataset``.
|
- AWS S3 path of the form ``s3://bucketname/path/to/dataset``.
|
||||||
Credentials are required in either the environment
|
Credentials are required in either the environment
|
||||||
- Google Cloud Storage path of the form
|
- Google Cloud Storage path of the form
|
||||||
``gcs://bucketname/path/to/dataset``Credentials are required
|
``gcs://bucketname/path/to/dataset`` Credentials are required
|
||||||
in either the environment
|
in either the environment
|
||||||
- Local file system path of the form ``./path/to/dataset`` or
|
- Local file system path of the form ``./path/to/dataset`` or
|
||||||
``~/path/to/dataset`` or ``path/to/dataset``.
|
``~/path/to/dataset`` or ``path/to/dataset``.
|
||||||
|
@ -30,7 +30,7 @@ class MyScaleSettings(BaseSettings):
|
|||||||
myscale_host (str) : An URL to connect to MyScale backend.
|
myscale_host (str) : An URL to connect to MyScale backend.
|
||||||
Defaults to 'localhost'.
|
Defaults to 'localhost'.
|
||||||
myscale_port (int) : URL port to connect with HTTP. Defaults to 8443.
|
myscale_port (int) : URL port to connect with HTTP. Defaults to 8443.
|
||||||
username (str) : Usernamed to login. Defaults to None.
|
username (str) : Username to login. Defaults to None.
|
||||||
password (str) : Password to login. Defaults to None.
|
password (str) : Password to login. Defaults to None.
|
||||||
index_type (str): index type string.
|
index_type (str): index type string.
|
||||||
index_param (dict): index build parameter.
|
index_param (dict): index build parameter.
|
||||||
@ -43,14 +43,16 @@ class MyScaleSettings(BaseSettings):
|
|||||||
semantics. Must have keys: `text`, `id`, `vector`,
|
semantics. Must have keys: `text`, `id`, `vector`,
|
||||||
must be same size to number of columns. For example:
|
must be same size to number of columns. For example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
{
|
|
||||||
'id': 'text_id',
|
{
|
||||||
'vector': 'text_embedding',
|
'id': 'text_id',
|
||||||
'text': 'text_plain',
|
'vector': 'text_embedding',
|
||||||
'metadata': 'metadata_dictionary_in_json',
|
'text': 'text_plain',
|
||||||
}
|
'metadata': 'metadata_dictionary_in_json',
|
||||||
|
}
|
||||||
|
|
||||||
Defaults to identity map.
|
Defaults to identity map.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
host: str = "localhost"
|
host: str = "localhost"
|
||||||
|
@ -382,10 +382,10 @@ class Qdrant(VectorStore):
|
|||||||
Additional arguments passed directly into REST client initialization
|
Additional arguments passed directly into REST client initialization
|
||||||
|
|
||||||
This is a user-friendly interface that:
|
This is a user-friendly interface that:
|
||||||
1. Creates embeddings, one for each text
|
1. Creates embeddings, one for each text
|
||||||
2. Initializes the Qdrant database as an in-memory docstore by default
|
2. Initializes the Qdrant database as an in-memory docstore by default
|
||||||
(and overridable to a remote docstore)
|
(and overridable to a remote docstore)
|
||||||
3. Adds the text embeddings to the Qdrant database
|
3. Adds the text embeddings to the Qdrant database
|
||||||
|
|
||||||
This is intended to be a quick way to get started.
|
This is intended to be a quick way to get started.
|
||||||
|
|
||||||
|
@ -298,8 +298,9 @@ class SupabaseVectorStore(VectorStore):
|
|||||||
List of Documents selected by maximal marginal relevance.
|
List of Documents selected by maximal marginal relevance.
|
||||||
|
|
||||||
`max_marginal_relevance_search` requires that `query_name` returns matched
|
`max_marginal_relevance_search` requires that `query_name` returns matched
|
||||||
embeddings alongside the match documents. The following function function
|
embeddings alongside the match documents. The following function
|
||||||
demonstrates how to do this:
|
demonstrates how to do this:
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
CREATE FUNCTION match_documents_embeddings(query_embedding vector(1536),
|
CREATE FUNCTION match_documents_embeddings(query_embedding vector(1536),
|
||||||
match_count int)
|
match_count int)
|
||||||
@ -326,7 +327,8 @@ class SupabaseVectorStore(VectorStore):
|
|||||||
docstore.embedding <=> query_embedding
|
docstore.embedding <=> query_embedding
|
||||||
LIMIT match_count;
|
LIMIT match_count;
|
||||||
END;
|
END;
|
||||||
$$;```
|
$$;
|
||||||
|
```
|
||||||
"""
|
"""
|
||||||
embedding = self._embedding.embed_documents([query])
|
embedding = self._embedding.embed_documents([query])
|
||||||
docs = self.max_marginal_relevance_search_by_vector(
|
docs = self.max_marginal_relevance_search_by_vector(
|
||||||
|
Loading…
Reference in New Issue
Block a user