Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Convert the NSO Gitbook Markdown Repository to the RAG Database and use it towards building a personal NSO AI Assistant.

License

Notifications You must be signed in to change notification settings

NSO-developer/gitbook-to-rag-converter

Repository files navigation

NSO Gitbook to RAG Converter

This repository clone the NSO Gitbook Repo https://github.com/NSO-developer/nso-gitbook/tree/main and convert it into RAG Database. The goal is to open up more opportunity for NSO AI Agent development. The RAG Database of choice here is Chroma and embeddings is "sentence-transformers/all-mpnet-base-v2" from HuggingFace.

Usage

  1. Install Dependency
pip install -r requirments.txt
  1. Generate RAG Database
make generate_rag
  1. Obtain information from RAG Database
QUERY="What is Operational Data in CDB" make query

API Usage

  1. Import Higher-level library
from gitbook_to_rag_converter.langchain_markdown import save_vdb, query_vdb
  1. Generate RAG Database.
save_vdb()
  1. Obtain information from RAG Database. while mode can be "max_marginal_relevance_search" or "similarity" while the default is "similarity"
data=query_vdb("What is Operational Data in CDB",mode="max_marginal_relevance_search",top_result=2)
print(data)

Config File - config.json

config.json is the file that used to define how the API going to work. The variable required are listed below

  • "vdb_path" - the location of RAG database
  • markdown_path" - The location of the gitbook (Recommend to keep this as it is)
  • "embedding_model" - What embedder will be used to populate RAG from Hugging Face
  • "doc_vers" - which NSO version of Gitbook Documentation do you want to populate into RAG. latest means the main branch.
{
    "vdb_path":"resource/vectordb",
    "markdown_path":"resource/nso-gitbook/",
    "embedding_model":"sentence-transformers/all-mpnet-base-v2",
    "doc_vers":["latest","6.4","6.3","6.2","6.1"]
}

Contribute

Feels free to fork the repository and open PR if you have good idea on how we can improve.

Thank you.

License

Copyright (c) 2025 Cisco and/or its affiliates.

This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at

               https://developer.cisco.com/docs/licenses

All use of the material herein must be in accordance with the terms of
the License. All rights not expressly granted by the License are
reserved. Unless required by applicable law or agreed to separately in
writing, software distributed under the License is distributed on an "AS
IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied.  

About

Convert the NSO Gitbook Markdown Repository to the RAG Database and use it towards building a personal NSO AI Assistant.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published