-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLoadIndex.fsx
More file actions
18 lines (15 loc) · 776 Bytes
/
Copy pathLoadIndex.fsx
File metadata and controls
18 lines (15 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#load "ScriptEnv.fsx"
open FSharp.Control
(*
Example script that loads a collection of PDF documents in a local folder
to an Azure vector search index
*)
ScriptEnv.installSettings "%USERPROFILE%/.fsopenai/ServiceSettings.json"
let embModel = "text-embedding-ada-002"
let clientFac() = ScriptEnv.openAiEmbeddingClient embModel
let shredded = ScriptEnv.Indexes.shredHtmlAsync @"C:\s\glean\plans"
let embedded = ScriptEnv.Indexes.getEmbeddingsAsync clientFac 7.0 shredded
let searchDocs = embedded |> AsyncSeq.map ScriptEnv.Indexes.toSearchDoc
let indexDef = ScriptEnv.Indexes.indexDefinition "plans"
ScriptEnv.Indexes.loadIndexAsync true indexDef searchDocs |> Async.Start
//let docs = Env.Index.shredHtmlAsync @"C:\s\glean\plans" |> AsyncSeq.toBlockingSeq |> Seq.toList