mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-29 09:58:44 +00:00
update golden-query notebook and fix typo in golden docs (#8253)
updating the documentation to be consistent for Golden query tool and have a better introduction to the tool
This commit is contained in:
parent
c14571ab37
commit
7734a2b5ab
@ -1,6 +1,6 @@
|
|||||||
# Golden
|
# Golden
|
||||||
|
|
||||||
>[Golden](https://golden.com) provides a set of natural language APIs for querying and enrichment using the Golden Knowledge Graph e.g. queries such as: `Products from OpenAI`, `Generative ai companies with series a funding`, and `rappers who invest` can be used to retrieve relevant structured data about relevant entities.
|
>[Golden](https://golden.com) provides a set of natural language APIs for querying and enrichment using the Golden Knowledge Graph e.g. queries such as: `Products from OpenAI`, `Generative ai companies with series a funding`, and `rappers who invest` can be used to retrieve structured data about relevant entities.
|
||||||
>
|
>
|
||||||
>The `golden-query` langchain tool is a wrapper on top of the [Golden Query API](https://docs.golden.com/reference/query-api) which enables programmatic access to these results.
|
>The `golden-query` langchain tool is a wrapper on top of the [Golden Query API](https://docs.golden.com/reference/query-api) which enables programmatic access to these results.
|
||||||
>See the [Golden Query API docs](https://docs.golden.com/reference/query-api) for more information.
|
>See the [Golden Query API docs](https://docs.golden.com/reference/query-api) for more information.
|
||||||
|
@ -1,142 +1,160 @@
|
|||||||
{
|
{
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
|
||||||
"attachments": {},
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"id": "245a954a",
|
|
||||||
"metadata": {},
|
|
||||||
"source": [
|
|
||||||
"# Golden Query\n",
|
|
||||||
"\n",
|
|
||||||
"This notebook goes over how to use the golden-query tool.\n",
|
|
||||||
"\n",
|
|
||||||
"- Go to the [Golden API docs](https://docs.golden.com/) to get an overview about the Golden API.\n",
|
|
||||||
"- Create a Golden account if you don't have one on the [Golden Website](golden.com).\n",
|
|
||||||
"- Get your API key from the [Golden API Settings](https://golden.com/settings/api) page.\n",
|
|
||||||
"- Save your API key into GOLDEN_API_KEY env variable"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 5,
|
|
||||||
"id": "34bb5968",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"import os\n",
|
|
||||||
"\n",
|
|
||||||
"os.environ[\"GOLDEN_API_KEY\"] = \"\""
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 6,
|
|
||||||
"id": "ac4910f8",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"from langchain.utilities.golden_query import GoldenQueryAPIWrapper"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 7,
|
|
||||||
"id": "84b8f773",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"golden_query = GoldenQueryAPIWrapper()"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 9,
|
|
||||||
"id": "068991a6",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [
|
|
||||||
{
|
{
|
||||||
"data": {
|
"cell_type": "markdown",
|
||||||
"text/plain": [
|
"id": "245a954a",
|
||||||
"{'results': [{'id': 4673886,\n",
|
"metadata": {
|
||||||
" 'latestVersionId': 60276991,\n",
|
"id": "245a954a"
|
||||||
" 'properties': [{'predicateId': 'name',\n",
|
},
|
||||||
" 'instances': [{'value': 'Samsung', 'citations': []}]}]},\n",
|
"source": [
|
||||||
" {'id': 7008,\n",
|
"# Golden Query\n",
|
||||||
" 'latestVersionId': 61087416,\n",
|
"\n",
|
||||||
" 'properties': [{'predicateId': 'name',\n",
|
">[Golden](https://golden.com) provides a set of natural language APIs for querying and enrichment using the Golden Knowledge Graph e.g. queries such as: `Products from OpenAI`, `Generative ai companies with series a funding`, and `rappers who invest` can be used to retrieve structured data about relevant entities.\n",
|
||||||
" 'instances': [{'value': 'Intel', 'citations': []}]}]},\n",
|
">\n",
|
||||||
" {'id': 24193,\n",
|
">The `golden-query` langchain tool is a wrapper on top of the [Golden Query API](https://docs.golden.com/reference/query-api) which enables programmatic access to these results.\n",
|
||||||
" 'latestVersionId': 60274482,\n",
|
">See the [Golden Query API docs](https://docs.golden.com/reference/query-api) for more information.\n",
|
||||||
" 'properties': [{'predicateId': 'name',\n",
|
"\n",
|
||||||
" 'instances': [{'value': 'Texas Instruments', 'citations': []}]}]},\n",
|
"\n",
|
||||||
" {'id': 1142,\n",
|
"This notebook goes over how to use the `golden-query` tool.\n",
|
||||||
" 'latestVersionId': 61406205,\n",
|
"\n",
|
||||||
" 'properties': [{'predicateId': 'name',\n",
|
"- Go to the [Golden API docs](https://docs.golden.com/) to get an overview about the Golden API.\n",
|
||||||
" 'instances': [{'value': 'Advanced Micro Devices', 'citations': []}]}]},\n",
|
"- Get your API key from the [Golden API Settings](https://golden.com/settings/api) page.\n",
|
||||||
" {'id': 193948,\n",
|
"- Save your API key into GOLDEN_API_KEY env variable"
|
||||||
" 'latestVersionId': 58326582,\n",
|
]
|
||||||
" 'properties': [{'predicateId': 'name',\n",
|
},
|
||||||
" 'instances': [{'value': 'Freescale Semiconductor', 'citations': []}]}]},\n",
|
{
|
||||||
" {'id': 91316,\n",
|
"cell_type": "code",
|
||||||
" 'latestVersionId': 60387380,\n",
|
"execution_count": null,
|
||||||
" 'properties': [{'predicateId': 'name',\n",
|
"id": "34bb5968",
|
||||||
" 'instances': [{'value': 'Agilent Technologies', 'citations': []}]}]},\n",
|
"metadata": {
|
||||||
" {'id': 90014,\n",
|
"id": "34bb5968"
|
||||||
" 'latestVersionId': 60388078,\n",
|
},
|
||||||
" 'properties': [{'predicateId': 'name',\n",
|
"outputs": [],
|
||||||
" 'instances': [{'value': 'Novartis', 'citations': []}]}]},\n",
|
"source": [
|
||||||
" {'id': 237458,\n",
|
"import os\n",
|
||||||
" 'latestVersionId': 61406160,\n",
|
"\n",
|
||||||
" 'properties': [{'predicateId': 'name',\n",
|
"os.environ[\"GOLDEN_API_KEY\"] = \"\""
|
||||||
" 'instances': [{'value': 'Analog Devices', 'citations': []}]}]},\n",
|
]
|
||||||
" {'id': 3941943,\n",
|
},
|
||||||
" 'latestVersionId': 60382250,\n",
|
{
|
||||||
" 'properties': [{'predicateId': 'name',\n",
|
"cell_type": "code",
|
||||||
" 'instances': [{'value': 'AbbVie Inc.', 'citations': []}]}]},\n",
|
"execution_count": null,
|
||||||
" {'id': 4178762,\n",
|
"id": "ac4910f8",
|
||||||
" 'latestVersionId': 60542667,\n",
|
"metadata": {
|
||||||
" 'properties': [{'predicateId': 'name',\n",
|
"id": "ac4910f8"
|
||||||
" 'instances': [{'value': 'IBM', 'citations': []}]}]}],\n",
|
},
|
||||||
" 'next': 'https://golden.com/api/v2/public/queries/59044/results/?cursor=eyJwb3NpdGlvbiI6IFsxNzYxNiwgIklCTS04M1lQM1oiXX0%3D&pageSize=10',\n",
|
"outputs": [],
|
||||||
" 'previous': None}"
|
"source": [
|
||||||
|
"from langchain.utilities.golden_query import GoldenQueryAPIWrapper"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "84b8f773",
|
||||||
|
"metadata": {
|
||||||
|
"id": "84b8f773"
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"golden_query = GoldenQueryAPIWrapper()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "068991a6",
|
||||||
|
"metadata": {
|
||||||
|
"id": "068991a6",
|
||||||
|
"outputId": "c5cdc6ec-03cf-4084-cc6f-6ae792d91d39"
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"{'results': [{'id': 4673886,\n",
|
||||||
|
" 'latestVersionId': 60276991,\n",
|
||||||
|
" 'properties': [{'predicateId': 'name',\n",
|
||||||
|
" 'instances': [{'value': 'Samsung', 'citations': []}]}]},\n",
|
||||||
|
" {'id': 7008,\n",
|
||||||
|
" 'latestVersionId': 61087416,\n",
|
||||||
|
" 'properties': [{'predicateId': 'name',\n",
|
||||||
|
" 'instances': [{'value': 'Intel', 'citations': []}]}]},\n",
|
||||||
|
" {'id': 24193,\n",
|
||||||
|
" 'latestVersionId': 60274482,\n",
|
||||||
|
" 'properties': [{'predicateId': 'name',\n",
|
||||||
|
" 'instances': [{'value': 'Texas Instruments', 'citations': []}]}]},\n",
|
||||||
|
" {'id': 1142,\n",
|
||||||
|
" 'latestVersionId': 61406205,\n",
|
||||||
|
" 'properties': [{'predicateId': 'name',\n",
|
||||||
|
" 'instances': [{'value': 'Advanced Micro Devices', 'citations': []}]}]},\n",
|
||||||
|
" {'id': 193948,\n",
|
||||||
|
" 'latestVersionId': 58326582,\n",
|
||||||
|
" 'properties': [{'predicateId': 'name',\n",
|
||||||
|
" 'instances': [{'value': 'Freescale Semiconductor', 'citations': []}]}]},\n",
|
||||||
|
" {'id': 91316,\n",
|
||||||
|
" 'latestVersionId': 60387380,\n",
|
||||||
|
" 'properties': [{'predicateId': 'name',\n",
|
||||||
|
" 'instances': [{'value': 'Agilent Technologies', 'citations': []}]}]},\n",
|
||||||
|
" {'id': 90014,\n",
|
||||||
|
" 'latestVersionId': 60388078,\n",
|
||||||
|
" 'properties': [{'predicateId': 'name',\n",
|
||||||
|
" 'instances': [{'value': 'Novartis', 'citations': []}]}]},\n",
|
||||||
|
" {'id': 237458,\n",
|
||||||
|
" 'latestVersionId': 61406160,\n",
|
||||||
|
" 'properties': [{'predicateId': 'name',\n",
|
||||||
|
" 'instances': [{'value': 'Analog Devices', 'citations': []}]}]},\n",
|
||||||
|
" {'id': 3941943,\n",
|
||||||
|
" 'latestVersionId': 60382250,\n",
|
||||||
|
" 'properties': [{'predicateId': 'name',\n",
|
||||||
|
" 'instances': [{'value': 'AbbVie Inc.', 'citations': []}]}]},\n",
|
||||||
|
" {'id': 4178762,\n",
|
||||||
|
" 'latestVersionId': 60542667,\n",
|
||||||
|
" 'properties': [{'predicateId': 'name',\n",
|
||||||
|
" 'instances': [{'value': 'IBM', 'citations': []}]}]}],\n",
|
||||||
|
" 'next': 'https://golden.com/api/v2/public/queries/59044/results/?cursor=eyJwb3NpdGlvbiI6IFsxNzYxNiwgIklCTS04M1lQM1oiXX0%3D&pageSize=10',\n",
|
||||||
|
" 'previous': None}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 9,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"\n",
|
||||||
|
"json.loads(golden_query.run(\"companies in nanotech\"))"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"execution_count": 9,
|
|
||||||
"metadata": {},
|
|
||||||
"output_type": "execute_result"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"metadata": {
|
||||||
"import json\n",
|
"kernelspec": {
|
||||||
"\n",
|
"display_name": ".venv",
|
||||||
"json.loads(golden_query.run(\"companies in nanotech\"))"
|
"language": "python",
|
||||||
]
|
"name": "python3"
|
||||||
}
|
},
|
||||||
],
|
"language_info": {
|
||||||
"metadata": {
|
"codemirror_mode": {
|
||||||
"kernelspec": {
|
"name": "ipython",
|
||||||
"display_name": ".venv",
|
"version": 3
|
||||||
"language": "python",
|
},
|
||||||
"name": "python3"
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.9.13"
|
||||||
|
},
|
||||||
|
"vscode": {
|
||||||
|
"interpreter": {
|
||||||
|
"hash": "53f3bc57609c7a84333bb558594977aa5b4026b1d6070b93987956689e367341"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"colab": {
|
||||||
|
"provenance": []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"language_info": {
|
"nbformat": 4,
|
||||||
"codemirror_mode": {
|
"nbformat_minor": 5
|
||||||
"name": "ipython",
|
|
||||||
"version": 3
|
|
||||||
},
|
|
||||||
"file_extension": ".py",
|
|
||||||
"mimetype": "text/x-python",
|
|
||||||
"name": "python",
|
|
||||||
"nbconvert_exporter": "python",
|
|
||||||
"pygments_lexer": "ipython3",
|
|
||||||
"version": "3.9.13"
|
|
||||||
},
|
|
||||||
"vscode": {
|
|
||||||
"interpreter": {
|
|
||||||
"hash": "53f3bc57609c7a84333bb558594977aa5b4026b1d6070b93987956689e367341"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nbformat": 4,
|
|
||||||
"nbformat_minor": 5
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user