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",
|
||||
"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",
|
||||
"- [Adding memory to an LLM Chain](../../memory/examples/adding_memory.ipynb)\n",
|
||||
"- [Custom Agents](custom_agent.ipynb)\n",
|
||||
"- [Adding memory to an LLM Chain](../../../memory/examples/adding_memory.ipynb)\n",
|
||||
"- [Custom Agents](../../agents/custom_agent.ipynb)\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."
|
||||
]
|
||||
|
@ -36,7 +36,7 @@ The first category of how-to guides here cover specific parts of working with ag
|
||||
:glob:
|
||||
:hidden:
|
||||
|
||||
./examples/*
|
||||
./agents/examples/*
|
||||
|
||||
|
||||
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`,
|
||||
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::
|
||||
:maxdepth: 1
|
||||
:glob:
|
||||
:hidden:
|
||||
|
||||
./agent_toolkits/*
|
||||
./toolkits/*
|
||||
|
||||
|
||||
Agent Types
|
||||
|
@ -9,7 +9,7 @@
|
||||
"\n",
|
||||
"LangChain provides async support for Chains by leveraging the [asyncio](https://docs.python.org/3/library/asyncio.html) library.\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",
|
||||
"generate_serially()\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
|
||||
------------------------------
|
||||
--------------------------------------
|
||||
These datasets and services are not from the public domain.
|
||||
These loaders mostly transform data from specific formats of applications or cloud services,
|
||||
for example **Google Drive**.
|
||||
|
@ -137,7 +137,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!poetry run pip -q install openai tiktoken chromadb "
|
||||
"!poetry run pip -q install openai tiktoken chromadb"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -317,7 +317,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"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",
|
||||
"\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",
|
||||
"In order to add a memory to an agent we are going to the the following steps:\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",
|
||||
"\n",
|
||||
"- [Adding memory to an LLM Chain](adding_memory.ipynb)\n",
|
||||
"- [Custom Agents](../../agents/examples/custom_agent.ipynb)\n",
|
||||
"- [Agent with Memory](agetn_with_memory.ipynb)\n",
|
||||
"- [Custom Agents](../../agents/agents/custom_agent.ipynb)\n",
|
||||
"- [Agent with Memory](agent_with_memory.ipynb)\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",
|
||||
"\n",
|
||||
|
@ -1,6 +1,6 @@
|
||||
==========
|
||||
====================
|
||||
Experimental Modules
|
||||
==========
|
||||
====================
|
||||
|
||||
This module contains experimental modules and reproductions of existing work using LangChain primitives.
|
||||
|
||||
|
@ -28,6 +28,7 @@ class ChatAnthropic(BaseChatModel, _AnthropicCommon):
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
import anthropic
|
||||
from langchain.llms import Anthropic
|
||||
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:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
AzureChatOpenAI(
|
||||
deployment_name="35-turbo-dev",
|
||||
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
|
||||
be passed here. The PromptLayerChatOpenAI adds to optional
|
||||
|
||||
parameters:
|
||||
``pl_tags``: List of strings to tag the request with.
|
||||
``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
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
from aleph_alpha import AlephAlphaSymmetricSemanticEmbedding
|
||||
|
||||
embeddings = AlephAlphaAsymmetricSemanticEmbedding()
|
||||
|
@ -66,30 +66,32 @@ class ElasticsearchEmbeddings(Embeddings):
|
||||
es_user: (str, optional): Elasticsearch username.
|
||||
es_password: (str, optional): Elasticsearch password.
|
||||
|
||||
Example Usage:
|
||||
from langchain.embeddings import ElasticsearchEmbeddings
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
# Define the model ID and input field name (if different from default)
|
||||
model_id = "your_model_id"
|
||||
# Optional, only if different from 'text_field'
|
||||
input_field = "your_input_field"
|
||||
from langchain.embeddings import ElasticsearchEmbeddings
|
||||
|
||||
# Credentials can be passed in two ways. Either set the env vars
|
||||
# ES_CLOUD_ID, ES_USER, ES_PASSWORD and they will be automatically pulled
|
||||
# in, or pass them in directly as kwargs.
|
||||
embeddings = ElasticsearchEmbeddings.from_credentials(
|
||||
model_id,
|
||||
input_field=input_field,
|
||||
# es_cloud_id="foo",
|
||||
# es_user="bar",
|
||||
# es_password="baz",
|
||||
)
|
||||
# Define the model ID and input field name (if different from default)
|
||||
model_id = "your_model_id"
|
||||
# Optional, only if different from 'text_field'
|
||||
input_field = "your_input_field"
|
||||
|
||||
documents = [
|
||||
"This is an example document.",
|
||||
"Another example document to generate embeddings for.",
|
||||
]
|
||||
embeddings_generator.embed_documents(documents)
|
||||
# Credentials can be passed in two ways. Either set the env vars
|
||||
# ES_CLOUD_ID, ES_USER, ES_PASSWORD and they will be automatically
|
||||
# pulled in, or pass them in directly as kwargs.
|
||||
embeddings = ElasticsearchEmbeddings.from_credentials(
|
||||
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:
|
||||
from elasticsearch import Elasticsearch
|
||||
@ -135,32 +137,35 @@ class ElasticsearchEmbeddings(Embeddings):
|
||||
Returns:
|
||||
ElasticsearchEmbeddings: An instance of the ElasticsearchEmbeddings class.
|
||||
|
||||
Example Usage:
|
||||
from elasticsearch import Elasticsearch
|
||||
from langchain.embeddings import ElasticsearchEmbeddings
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
# Define the model ID and input field name (if different from default)
|
||||
model_id = "your_model_id"
|
||||
# Optional, only if different from 'text_field'
|
||||
input_field = "your_input_field"
|
||||
from elasticsearch import Elasticsearch
|
||||
|
||||
# Create Elasticsearch connection
|
||||
es_connection = Elasticsearch(
|
||||
hosts=["localhost:9200"], http_auth=("user", "password")
|
||||
)
|
||||
from langchain.embeddings import ElasticsearchEmbeddings
|
||||
|
||||
# Instantiate ElasticsearchEmbeddings using the existing connection
|
||||
embeddings = ElasticsearchEmbeddings.from_es_connection(
|
||||
model_id,
|
||||
es_connection,
|
||||
input_field=input_field,
|
||||
)
|
||||
# Define the model ID and input field name (if different from default)
|
||||
model_id = "your_model_id"
|
||||
# Optional, only if different from 'text_field'
|
||||
input_field = "your_input_field"
|
||||
|
||||
documents = [
|
||||
"This is an example document.",
|
||||
"Another example document to generate embeddings for.",
|
||||
]
|
||||
embeddings_generator.embed_documents(documents)
|
||||
# Create Elasticsearch connection
|
||||
es_connection = Elasticsearch(
|
||||
hosts=["localhost:9200"], http_auth=("user", "password")
|
||||
)
|
||||
|
||||
# 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
|
||||
# avoid unnecessary import if the method is not used
|
||||
|
@ -107,6 +107,7 @@ class Anthropic(LLM, _AnthropicCommon):
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
import anthropic
|
||||
from langchain.llms import Anthropic
|
||||
model = Anthropic(model="<model_name>", anthropic_api_key="my-api-key")
|
||||
|
@ -18,6 +18,7 @@ class Anyscale(LLM):
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
from langchain.llms import Anyscale
|
||||
anyscale = Anyscale(anyscale_service_url="SERVICE_URL",
|
||||
anyscale_service_route="SERVICE_ROUTE",
|
||||
|
@ -23,6 +23,7 @@ class Banana(LLM):
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
from langchain.llms import Banana
|
||||
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,
|
||||
python version, and python packages can be updated accordingly. Once deployed,
|
||||
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()
|
||||
call_result = llm._call(input)
|
||||
Example:
|
||||
.. 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 = ""
|
||||
|
@ -23,6 +23,7 @@ class CerebriumAI(LLM):
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
from langchain.llms import CerebriumAI
|
||||
cerebrium = CerebriumAI(endpoint_url="")
|
||||
|
||||
|
@ -22,6 +22,7 @@ class GooseAI(LLM):
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
from langchain.llms import GooseAI
|
||||
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]:
|
||||
"""
|
||||
Performs sanity check, preparing paramaters in format needed by llama_cpp.
|
||||
Performs sanity check, preparing parameters in format needed by llama_cpp.
|
||||
|
||||
Args:
|
||||
stop (Optional[List[str]]): List of stop sequences for llama_cpp.
|
||||
@ -238,7 +238,7 @@ class LlamaCpp(LLM):
|
||||
) -> Generator[Dict, None, None]:
|
||||
"""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.
|
||||
|
||||
It also calls the callback manager's on_llm_new_token event with
|
||||
|
@ -22,6 +22,7 @@ class Modal(LLM):
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
from langchain.llms import Modal
|
||||
modal = Modal(endpoint_url="")
|
||||
|
||||
|
@ -23,6 +23,7 @@ class Petals(LLM):
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
from langchain.llms import petals
|
||||
petals = Petals()
|
||||
|
||||
|
@ -23,6 +23,7 @@ class PipelineAI(LLM, BaseModel):
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
from langchain import PipelineAI
|
||||
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
|
||||
with OpenAI models, set the environment variable ``OPENAI_API_KEY`` with your
|
||||
OpenAI API key as well.
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
pgllm = PredictionGuard(model="MPT-7B-Instruct",
|
||||
token="my-access-token",
|
||||
output={
|
||||
|
@ -20,6 +20,7 @@ class PromptLayerOpenAI(OpenAI):
|
||||
|
||||
All parameters that can be passed to the OpenAI LLM can also
|
||||
be passed here. The PromptLayerOpenAI LLM adds two optional
|
||||
|
||||
parameters:
|
||||
``pl_tags``: List of strings to tag the request with.
|
||||
``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
|
||||
be passed here. The PromptLayerOpenAIChat adds two optional
|
||||
|
||||
parameters:
|
||||
``pl_tags``: List of strings to tag the request with.
|
||||
``return_pl_id``: If True, the PromptLayer request ID will be
|
||||
|
@ -23,6 +23,7 @@ class Replicate(LLM):
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
from langchain.llms import Replicate
|
||||
replicate = Replicate(model="stability-ai/stable-diffusion: \
|
||||
27b93a2413e7f36cd83da926f365628\
|
||||
|
@ -20,6 +20,7 @@ DEFAULT_PORT = 9042
|
||||
|
||||
class CassandraChatMessageHistory(BaseChatMessageHistory):
|
||||
"""Chat message history that stores history in Cassandra.
|
||||
|
||||
Args:
|
||||
contact_points: list of ips to connect to Cassandra cluster
|
||||
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
|
||||
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
|
||||
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
|
||||
from `instructions` (see "understanding the AI guessing flow" here:
|
||||
https://nla.zapier.com/api/v1/docs)
|
||||
|
||||
"""
|
||||
|
||||
api_wrapper: ZapierNLAWrapper = Field(default_factory=ZapierNLAWrapper)
|
||||
@ -160,6 +161,7 @@ class ZapierNLAListActions(BaseTool):
|
||||
"""
|
||||
Args:
|
||||
None
|
||||
|
||||
"""
|
||||
|
||||
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
|
||||
(see https://lukasschwab.me/arxiv.py/index.html#Result),
|
||||
if False: the `metadata` gets only the most informative fields.
|
||||
|
||||
"""
|
||||
|
||||
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.
|
||||
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
|
||||
the list of Sites to search.
|
||||
the list of Sites to search.
|
||||
- Under Search engine ID you’ll find the search-engine-ID.
|
||||
|
||||
4. Enable the Custom Search API
|
||||
|
@ -3,11 +3,11 @@
|
||||
SearxNG is a privacy-friendly free metasearch engine that aggregates results from
|
||||
`multiple search engines
|
||||
<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>`_
|
||||
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
|
||||
|
||||
@ -40,7 +40,7 @@ Searching
|
||||
|
||||
Use the :meth:`run() <SearxSearchWrapper.run>` and
|
||||
: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.
|
||||
|
||||
@ -415,33 +415,22 @@ class SearxSearchWrapper(BaseModel):
|
||||
|
||||
Args:
|
||||
query: The query to search for.
|
||||
|
||||
query_suffix: Extra suffix appended to the query.
|
||||
|
||||
num_results: Limit the number of results to return.
|
||||
|
||||
engines: List of engines to use for the query.
|
||||
|
||||
categories: List of categories to use for the query.
|
||||
|
||||
**kwargs: extra parameters to pass to the searx API.
|
||||
|
||||
Returns:
|
||||
Dict with the following keys:
|
||||
|
||||
{
|
||||
snippet: The description of the result.
|
||||
|
||||
title: The title of the result.
|
||||
|
||||
link: The link to the result.
|
||||
|
||||
engines: The engines used for the result.
|
||||
|
||||
category: Searx category of the result.
|
||||
}
|
||||
|
||||
|
||||
"""
|
||||
_params = {
|
||||
"q": query,
|
||||
|
@ -121,6 +121,7 @@ class AnalyticDB(VectorStore):
|
||||
- `pre_delete_collection` if True, will delete the collection if it exists.
|
||||
(default: False)
|
||||
- Useful for testing.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
@ -52,7 +52,6 @@ class VectorStore(ABC):
|
||||
Args:
|
||||
documents (List[Document]: Documents to add to the vectorstore.
|
||||
|
||||
|
||||
Returns:
|
||||
List[str]: List of IDs of the added texts.
|
||||
"""
|
||||
|
@ -244,6 +244,7 @@ class Chroma(VectorStore):
|
||||
"""Return docs selected using the maximal marginal relevance.
|
||||
Maximal marginal relevance optimizes for similarity to query AND diversity
|
||||
among selected documents.
|
||||
|
||||
Args:
|
||||
embedding: Embedding to look up documents similar to.
|
||||
k: Number of Documents to return. Defaults to 4.
|
||||
@ -253,6 +254,7 @@ class Chroma(VectorStore):
|
||||
to maximum diversity and 1 to minimum diversity.
|
||||
Defaults to 0.5.
|
||||
filter (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.
|
||||
|
||||
Returns:
|
||||
List of Documents selected by maximal marginal relevance.
|
||||
"""
|
||||
@ -287,6 +289,7 @@ class Chroma(VectorStore):
|
||||
"""Return docs selected using the maximal marginal relevance.
|
||||
Maximal marginal relevance optimizes for similarity to query AND diversity
|
||||
among selected documents.
|
||||
|
||||
Args:
|
||||
query: Text to look up documents similar to.
|
||||
k: Number of Documents to return. Defaults to 4.
|
||||
@ -296,6 +299,7 @@ class Chroma(VectorStore):
|
||||
to maximum diversity and 1 to minimum diversity.
|
||||
Defaults to 0.5.
|
||||
filter (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.
|
||||
|
||||
Returns:
|
||||
List of Documents selected by maximal marginal relevance.
|
||||
"""
|
||||
|
@ -391,6 +391,7 @@ class DeepLake(VectorStore):
|
||||
Args:
|
||||
embedding: Embedding to look up documents similar to.
|
||||
k: Number of Documents to return. Defaults to 4.
|
||||
|
||||
Returns:
|
||||
List of Documents most similar to the query vector.
|
||||
"""
|
||||
@ -412,6 +413,7 @@ class DeepLake(VectorStore):
|
||||
Defaults to `L2`.
|
||||
k (int): Number of results to return. Defaults to 4.
|
||||
filter (Optional[Dict[str, str]]): Filter by metadata. Defaults to None.
|
||||
|
||||
Returns:
|
||||
List[Tuple[Document, float]]: List of documents most similar to the query
|
||||
text with distance in float.
|
||||
@ -435,14 +437,16 @@ class DeepLake(VectorStore):
|
||||
"""Return docs selected using the maximal marginal relevance.
|
||||
Maximal marginal relevance optimizes for similarity to query AND diversity
|
||||
among selected documents.
|
||||
|
||||
Args:
|
||||
embedding: Embedding to look up documents similar to.
|
||||
k: Number of Documents to return. Defaults to 4.
|
||||
fetch_k: Number of Documents to fetch to pass to MMR algorithm.
|
||||
lambda_mult: Number between 0 and 1 that determines the degree
|
||||
of diversity among the results with 0 corresponding
|
||||
to maximum diversity and 1 to minimum diversity.
|
||||
Defaults to 0.5.
|
||||
of diversity among the results with 0 corresponding
|
||||
to maximum diversity and 1 to minimum diversity.
|
||||
Defaults to 0.5.
|
||||
|
||||
Returns:
|
||||
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``.
|
||||
Credentials are required in either the environment
|
||||
- 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
|
||||
- Local file system path of the form ``./path/to/dataset`` or
|
||||
``~/path/to/dataset`` or ``path/to/dataset``.
|
||||
|
@ -30,7 +30,7 @@ class MyScaleSettings(BaseSettings):
|
||||
myscale_host (str) : An URL to connect to MyScale backend.
|
||||
Defaults to 'localhost'.
|
||||
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.
|
||||
index_type (str): index type string.
|
||||
index_param (dict): index build parameter.
|
||||
@ -43,14 +43,16 @@ class MyScaleSettings(BaseSettings):
|
||||
semantics. Must have keys: `text`, `id`, `vector`,
|
||||
must be same size to number of columns. For example:
|
||||
.. code-block:: python
|
||||
{
|
||||
'id': 'text_id',
|
||||
'vector': 'text_embedding',
|
||||
'text': 'text_plain',
|
||||
'metadata': 'metadata_dictionary_in_json',
|
||||
}
|
||||
|
||||
{
|
||||
'id': 'text_id',
|
||||
'vector': 'text_embedding',
|
||||
'text': 'text_plain',
|
||||
'metadata': 'metadata_dictionary_in_json',
|
||||
}
|
||||
|
||||
Defaults to identity map.
|
||||
|
||||
"""
|
||||
|
||||
host: str = "localhost"
|
||||
|
@ -382,10 +382,10 @@ class Qdrant(VectorStore):
|
||||
Additional arguments passed directly into REST client initialization
|
||||
|
||||
This is a user-friendly interface that:
|
||||
1. Creates embeddings, one for each text
|
||||
2. Initializes the Qdrant database as an in-memory docstore by default
|
||||
(and overridable to a remote docstore)
|
||||
3. Adds the text embeddings to the Qdrant database
|
||||
1. Creates embeddings, one for each text
|
||||
2. Initializes the Qdrant database as an in-memory docstore by default
|
||||
(and overridable to a remote docstore)
|
||||
3. Adds the text embeddings to the Qdrant database
|
||||
|
||||
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.
|
||||
|
||||
`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:
|
||||
|
||||
```sql
|
||||
CREATE FUNCTION match_documents_embeddings(query_embedding vector(1536),
|
||||
match_count int)
|
||||
@ -326,7 +327,8 @@ class SupabaseVectorStore(VectorStore):
|
||||
docstore.embedding <=> query_embedding
|
||||
LIMIT match_count;
|
||||
END;
|
||||
$$;```
|
||||
$$;
|
||||
```
|
||||
"""
|
||||
embedding = self._embedding.embed_documents([query])
|
||||
docs = self.max_marginal_relevance_search_by_vector(
|
||||
|
Loading…
Reference in New Issue
Block a user