Json Linker
Json Linker Class Documentation
Overview
JsonLinker
is a singleton class that allows the role of a linker to be played locally to use JSON file without using an external DB like redisDB or dynamoDB.
The class manages JSON files. It is used to link database and passage IDs that are stored in retrievals. The class is part of the RAGchain
project and is located in the RAGchain/utils/linker/json_linker.py
file.
The class inherits from the BaseLinker class and implements the put_json, get_json, and flush_db abstract methods.
The class uses the json
Python library to interact with a JSON file. It requires the JSON_LINKER_PATH
environment variable to be set, which specifies the path to the JSON file.
Usage
To use the JsonLinker
class, you first need to set the required environment variable LINKER_TYPE
and JSON_LINKER_PATH
.
Here is an example of how to use the JsonLinker
class:
Please note that the put_json
method requires a unique ID and a JSON data as parameters. The get_json
method requires a list of IDs as a parameter. The flush_db
method does not require any parameters.
Last updated