@@ -3,6 +3,9 @@ import { readFile } from "fs/promises";
33import { Document } from "langchain/document" ;
44import { MarkdownTextSplitter } from "langchain/text_splitter" ;
55
6+ /**
7+ * @returns {Promise<Document[]> }
8+ */
69const getDocumentation = async ( ) => {
710 const filenames = await glob ( [
811 "./sources/website/src/routes/docs/**/*.markdoc" ,
@@ -36,6 +39,9 @@ const getDocumentation = async () => {
3639 ) ;
3740} ;
3841
42+ /**
43+ * @returns {Promise<Document[]> } Array of Document objects containing processed references
44+ */
3945const getReferences = async ( ) => {
4046 const filenames = await glob ( [ "./sources/references/**/*.md" ] ) ;
4147
@@ -64,7 +70,7 @@ export const getDocuments = async () => {
6470 return await splitDocuments ( [ ...documentation , ...references ] ) ;
6571} ;
6672
67- /**x
73+ /**
6874 * @param {Document[] } documents
6975 * @returns {Promise<Document<Record<string, any>>[]> }
7076 */
@@ -80,6 +86,10 @@ async function splitDocuments(documents) {
8086 return await splitter . createDocuments ( texts , metadatas ) ;
8187}
8288
89+ /**
90+ * @param {string } contents
91+ * @returns {Object.<string, string> }
92+ */
8393function parseMarkdownFrontmatter ( contents ) {
8494 const raw = contents . match ( / ^ - - - \n ( [ \s \S ] * ?) \n - - - / ) ;
8595 if ( ! raw ) {
@@ -94,6 +104,10 @@ function parseMarkdownFrontmatter(contents) {
94104 return frontmatter ;
95105}
96106
107+ /**
108+ * @param {string } filename
109+ * @returns {{sdk: string, service: string} }
110+ */
97111function parseReferenceData ( filename ) {
98112 const [ sdk , service ] = filename
99113 . replace ( "sources/references/" , "" )
0 commit comments