From 1ef13661b99209a4ff3c2ec484849daee0af2ffc Mon Sep 17 00:00:00 2001 From: Leonid Ganeline Date: Fri, 8 Dec 2023 15:24:38 -0800 Subject: [PATCH] docs[patch]: link and description cleanup (#14471) Fixed inconsistencies; added links and descriptions --------- Co-authored-by: Erick Friis --- docs/docs/guides/evaluation/string/json.ipynb | 8 ++--- .../evaluation/string/string_distance.ipynb | 11 ++++--- .../integrations/platforms/huggingface.mdx | 11 +++++++ .../integrations/providers/dataforseo.mdx | 32 ++++++++----------- docs/docs/integrations/tools/dataforseo.ipynb | 8 +++-- 5 files changed, 41 insertions(+), 29 deletions(-) diff --git a/docs/docs/guides/evaluation/string/json.ipynb b/docs/docs/guides/evaluation/string/json.ipynb index 4db1284482..a158604711 100644 --- a/docs/docs/guides/evaluation/string/json.ipynb +++ b/docs/docs/guides/evaluation/string/json.ipynb @@ -5,13 +5,13 @@ "id": "465cfbef-5bba-4b3b-b02d-fe2eba39db17", "metadata": {}, "source": [ - "# Evaluating Structured Output: JSON Evaluators\n", + "# JSON Evaluators\n", "\n", - "Evaluating [extraction](https://python.langchain.com/docs/use_cases/extraction) and function calling applications often comes down to validation that the LLM's string output can be parsed correctly and how it compares to a reference object. The following JSON validators provide provide functionality to check your model's output in a consistent way.\n", + "Evaluating [extraction](https://python.langchain.com/docs/use_cases/extraction) and function calling applications often comes down to validation that the LLM's string output can be parsed correctly and how it compares to a reference object. The following `JSON` validators provide functionality to check your model's output consistently.\n", "\n", "## JsonValidityEvaluator\n", "\n", - "The `JsonValidityEvaluator` is designed to check the validity of a JSON string prediction.\n", + "The `JsonValidityEvaluator` is designed to check the validity of a `JSON` string prediction.\n", "\n", "### Overview:\n", "- **Requires Input?**: No\n", @@ -377,7 +377,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.2" + "version": "3.10.12" } }, "nbformat": 4, diff --git a/docs/docs/guides/evaluation/string/string_distance.ipynb b/docs/docs/guides/evaluation/string/string_distance.ipynb index 18ecf95c00..4d762d2172 100644 --- a/docs/docs/guides/evaluation/string/string_distance.ipynb +++ b/docs/docs/guides/evaluation/string/string_distance.ipynb @@ -8,9 +8,12 @@ "# String Distance\n", "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/langchain-ai/langchain/blob/master/docs/docs/guides/evaluation/string/string_distance.ipynb)\n", "\n", - "One of the simplest ways to compare an LLM or chain's string output against a reference label is by using string distance measurements such as Levenshtein or postfix distance. This can be used alongside approximate/fuzzy matching criteria for very basic unit testing.\n", + ">In information theory, linguistics, and computer science, the [Levenshtein distance (Wikipedia)](https://en.wikipedia.org/wiki/Levenshtein_distance) is a string metric for measuring the difference between two sequences. Informally, the Levenshtein distance between two words is the minimum number of single-character edits (insertions, deletions or substitutions) required to change one word into the other. It is named after the Soviet mathematician Vladimir Levenshtein, who considered this distance in 1965.\n", "\n", - "This can be accessed using the `string_distance` evaluator, which uses distance metric's from the [rapidfuzz](https://github.com/maxbachmann/RapidFuzz) library.\n", + "\n", + "One of the simplest ways to compare an LLM or chain's string output against a reference label is by using string distance measurements such as `Levenshtein` or `postfix` distance. This can be used alongside approximate/fuzzy matching criteria for very basic unit testing.\n", + "\n", + "This can be accessed using the `string_distance` evaluator, which uses distance metrics from the [rapidfuzz](https://github.com/maxbachmann/RapidFuzz) library.\n", "\n", "**Note:** The returned scores are _distances_, meaning lower is typically \"better\".\n", "\n", @@ -213,9 +216,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.2" + "version": "3.10.12" } }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} diff --git a/docs/docs/integrations/platforms/huggingface.mdx b/docs/docs/integrations/platforms/huggingface.mdx index 0a954be8e6..5f768c6d5b 100644 --- a/docs/docs/integrations/platforms/huggingface.mdx +++ b/docs/docs/integrations/platforms/huggingface.mdx @@ -115,6 +115,17 @@ See a [usage example](/docs/integrations/text_embedding/instruct_embeddings). from langchain.embeddings import HuggingFaceInstructEmbeddings ``` +#### HuggingFaceBgeEmbeddings + +>[BGE models on the HuggingFace](https://huggingface.co/BAAI/bge-large-en) are [the best open-source embedding models](https://huggingface.co/spaces/mteb/leaderboard). +>BGE model is created by the [Beijing Academy of Artificial Intelligence (BAAI)](https://www.baai.ac.cn/english.html). `BAAI` is a private non-profit organization engaged in AI research and development. + +See a [usage example](/docs/integrations/text_embedding/bge_huggingface). + +```python +from langchain.embeddings import HuggingFaceBgeEmbeddings +``` + ## Tools diff --git a/docs/docs/integrations/providers/dataforseo.mdx b/docs/docs/integrations/providers/dataforseo.mdx index f5c1ba0631..339daaada2 100644 --- a/docs/docs/integrations/providers/dataforseo.mdx +++ b/docs/docs/integrations/providers/dataforseo.mdx @@ -1,14 +1,23 @@ # DataForSEO +>[DataForSeo](https://dataforseo.com/) provides comprehensive SEO and digital marketing data solutions via API. + This page provides instructions on how to use the DataForSEO search APIs within LangChain. ## Installation and Setup -- Get a DataForSEO API Access login and password, and set them as environment variables (`DATAFORSEO_LOGIN` and `DATAFORSEO_PASSWORD` respectively). You can find it in your dashboard. +Get a [DataForSEO API Access login and password](https://app.dataforseo.com/register), and set them as environment variables +(`DATAFORSEO_LOGIN` and `DATAFORSEO_PASSWORD` respectively). + +```python +import os + +os.environ["DATAFORSEO_LOGIN"] = "your_login" +os.environ["DATAFORSEO_PASSWORD"] = "your_password" +``` -## Wrappers -### Utility +## Utility The DataForSEO utility wraps the API. To import this utility, use: @@ -18,7 +27,7 @@ from langchain.utilities.dataforseo_api_search import DataForSeoAPIWrapper For a detailed walkthrough of this wrapper, see [this notebook](/docs/integrations/tools/dataforseo). -### Tool +## Tool You can also load this wrapper as a Tool to use with an Agent: @@ -34,18 +43,3 @@ dataforseo = DataForSeoAPIWrapper(api_login="your_login", api_password="your_pas result = dataforseo.run("Bill Gates") print(result) ``` - -## Environment Variables - -You can store your DataForSEO API Access login and password as environment variables. The wrapper will automatically check for these environment variables if no values are provided: - -```python -import os - -os.environ["DATAFORSEO_LOGIN"] = "your_login" -os.environ["DATAFORSEO_PASSWORD"] = "your_password" - -dataforseo = DataForSeoAPIWrapper() -result = dataforseo.run("weather in Los Angeles") -print(result) -``` diff --git a/docs/docs/integrations/tools/dataforseo.ipynb b/docs/docs/integrations/tools/dataforseo.ipynb index fbf4b2c780..51ed746869 100644 --- a/docs/docs/integrations/tools/dataforseo.ipynb +++ b/docs/docs/integrations/tools/dataforseo.ipynb @@ -4,9 +4,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# DataForSeo\n", + "# DataForSEO\n", "\n", - "This notebook demonstrates how to use the `DataForSeo API` to obtain search engine results. The `DataForSeo API` retrieves `SERP` from most popular search engines like `Google`, `Bing`, `Yahoo`. It also allows to get SERPs from different search engine types like `Maps`, `News`, `Events`, etc.\n" + ">[DataForSeo](https://dataforseo.com/) provides comprehensive SEO and digital marketing data solutions via API.\n", + ">\n", + ">The `DataForSeo API` retrieves `SERP` from the most popular search engines like `Google`, `Bing`, `Yahoo`. It also allows to >get SERPs from different search engine types like `Maps`, `News`, `Events`, etc.\n", + "\n", + "This notebook demonstrates how to use the [DataForSeo API](https://dataforseo.com/apis) to obtain search engine results. " ] }, {