mirror of
https://github.com/hwchase17/langchain.git
synced 2026-04-02 18:32:56 +00:00
Use docusaurus versioning with a callout, merged master as well @hwchase17 @baskaryan --------- Signed-off-by: Weichen Xu <weichen.xu@databricks.com> Signed-off-by: Rahul Tripathi <rauhl.psit.ec@gmail.com> Co-authored-by: Leonid Ganeline <leo.gan.57@gmail.com> Co-authored-by: Leonid Kuligin <lkuligin@yandex.ru> Co-authored-by: Averi Kitsch <akitsch@google.com> Co-authored-by: Erick Friis <erick@langchain.dev> Co-authored-by: Nuno Campos <nuno@langchain.dev> Co-authored-by: Nuno Campos <nuno@boringbits.io> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com> Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com> Co-authored-by: Martín Gotelli Ferenaz <martingotelliferenaz@gmail.com> Co-authored-by: Fayfox <admin@fayfox.com> Co-authored-by: Eugene Yurtsev <eugene@langchain.dev> Co-authored-by: Dawson Bauer <105886620+djbauer2@users.noreply.github.com> Co-authored-by: Ravindu Somawansa <ravindu.somawansa@gmail.com> Co-authored-by: Dhruv Chawla <43818888+Dominastorm@users.noreply.github.com> Co-authored-by: ccurme <chester.curme@gmail.com> Co-authored-by: Bagatur <baskaryan@gmail.com> Co-authored-by: WeichenXu <weichen.xu@databricks.com> Co-authored-by: Benito Geordie <89472452+benitoThree@users.noreply.github.com> Co-authored-by: kartikTAI <129414343+kartikTAI@users.noreply.github.com> Co-authored-by: Kartik Sarangmath <kartik@thirdai.com> Co-authored-by: Sevin F. Varoglu <sfvaroglu@octoml.ai> Co-authored-by: MacanPN <martin.triska@gmail.com> Co-authored-by: Prashanth Rao <35005448+prrao87@users.noreply.github.com> Co-authored-by: Hyeongchan Kim <kozistr@gmail.com> Co-authored-by: sdan <git@sdan.io> Co-authored-by: Guangdong Liu <liugddx@gmail.com> Co-authored-by: Rahul Triptahi <rahul.psit.ec@gmail.com> Co-authored-by: Rahul Tripathi <rauhl.psit.ec@gmail.com> Co-authored-by: pjb157 <84070455+pjb157@users.noreply.github.com> Co-authored-by: Eun Hye Kim <ehkim1440@gmail.com> Co-authored-by: kaijietti <43436010+kaijietti@users.noreply.github.com> Co-authored-by: Pengcheng Liu <pcliu.fd@gmail.com> Co-authored-by: Tomer Cagan <tomer@tomercagan.com> Co-authored-by: Christophe Bornet <cbornet@hotmail.com>
160 lines
5.7 KiB
Plaintext
160 lines
5.7 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "245a954a",
|
|
"metadata": {
|
|
"id": "245a954a"
|
|
},
|
|
"source": [
|
|
"# Golden Query\n",
|
|
"\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",
|
|
">\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",
|
|
">See the [Golden Query API docs](https://docs.golden.com/reference/query-api) for more information.\n",
|
|
"\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",
|
|
"- 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": null,
|
|
"id": "34bb5968",
|
|
"metadata": {
|
|
"id": "34bb5968"
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"import os\n",
|
|
"\n",
|
|
"os.environ[\"GOLDEN_API_KEY\"] = \"\""
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "ac4910f8",
|
|
"metadata": {
|
|
"id": "ac4910f8"
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"from langchain_community.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\"))"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": ".venv",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"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"
|
|
}
|
|
},
|
|
"colab": {
|
|
"provenance": []
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
} |