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.
- Install Dependency
pip install -r requirments.txt
- Generate RAG Database
make generate_rag
- Obtain information from RAG Database
QUERY="What is Operational Data in CDB" make query
- Import Higher-level library
from gitbook_to_rag_converter.langchain_markdown import save_vdb, query_vdb
- Generate RAG Database.
save_vdb()
- 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.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"]
}
Feels free to fork the repository and open PR if you have good idea on how we can improve.
Thank you.
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.