This repository contains the OpenAPI specification and API pipeline manifest needed to create a RAG pipeline. This pipeline generates a knowledge base from RetroPGF projects and proposals within the OP collective.
To access this API, you'll need an API key. You can request one through the Agora's Discord server. You can run the rag-api-pipeline setup
command to set the REST API Key,
or your can directly store the key in the config/secrets/api-key
file. A less secure option is to provide it using the --api-key
CLI argument.
This pipeline will extract data related to DAO proposals (/proposals
) and RetroPGF projects (/projects
).
Next, you can find an overview of the main sections in the API pipeline manifest.
Since no api_parameters
are required, this section remains empty.
api_name: "optimism_agora_api"
api_parameters:
api_config:
request_method: "get"
content_type: "application/json"
response_entrypoint_field: "data"
The manifest then defines some metadata and the request parameters needed for making calls to the API. In this case, it only needs an api_key
parameter for authentication:
spec:
connection_specification:
$schema: http://json-schema.org/draft-07/schema#
additionalProperties: true
properties:
api_key:
airbyte-secret: true
description: Agora API Key.
type: string
required:
- api_key
title: Agora API Spec
type: object
documentation_url: https://docs.airbyte.com/integrations/sources/agora
type: Spec
Below is the requester_base
definition. The API implements a BearerAuthenticator schema and retrieves the api_token
from the config
object:
definition:
requester_base:
type: HttpRequester
url_base: "https://vote.optimism.io/api/v1"
http_method: "GET"
authenticator: # Details at https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/authentication
type: BearerAuthenticator
api_token: "{{ config['api_key'] }}"
The API uses an Offset-based pagination strategy. The page_size
is set to 50, while offset
and limit
parameters are dynamically inserted into the URL as request parameters:
definition:
paginator: # Details at https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/pagination
type: DefaultPaginator
pagination_strategy: # Details at https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/pagination#offset-increment
type: "OffsetIncrement"
page_size: 50
page_token_option:
type: "RequestOption"
field_name: "offset"
inject_into: "request_parameter"
page_size_option:
type: "RequestOption"
inject_into: "request_parameter"
field_name: "limit"
Below are the target endpoints with their respective schemas:
endpoints:
/proposals:
id: "proposals"
primary_key: "id"
responseSchema: "#/schemas/Proposal"
textSchema:
$ref: "#/textSchemas/Proposal"
/projects:
id: "projects"
primary_key: "id"
responseSchema: "#/schemas/Project"
textSchema:
$ref: "#/textSchemas/Project"
- Make sure to setup the pipeline initial settings by running the
rag-api-pipeline setup
command. - Execute the following command:
rag-api-pipeline run all config/agora_api_pipeline.yaml config/agora_openapi.yaml
After execution, you'll find the processed data and compressed knowledge base snapshot in the output/optimism_agora_api
folder.
- Locate the generated snapshot in
output/optimism_agora_api/
(namedoptimism_agora_api_collection-xxxxxxxxxxxxxxxx-yyyy-mm-dd-hh-mm-ss.snapshot.tar.gz
) or download it from the HuggingFace link above. - Follow the official knowledge base selection guide
- Configure your node using the recommended settings from the node deployment guide.
Do not forget to update the custom prompts to mention
optimism
as the target DAO protocol.