43 lines
857 B
Go
43 lines
857 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"ctxGPT/LLMMapper"
|
|
"ctxGPT/database"
|
|
"ctxGPT/promptBuilder"
|
|
"fmt"
|
|
)
|
|
|
|
func main() {
|
|
|
|
db, err := database.NewDB()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
defer db.Close()
|
|
value, err := db.Get(context.Background(), "context1")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Println(value)
|
|
|
|
err = db.Save(context.Background(), "context2", "value2")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// to get text out of PDF, DOC, DOCX, XML, HTML, RTF, ODT pages documents and images to plain text
|
|
// use https://github.com/sajari/docconv
|
|
|
|
summarizeConvoPrompt, err := promptBuilder.BuildPrompt("summarize.tmpl", struct{ WordLimit int }{WordLimit: 100})
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Println(summarizeConvoPrompt)
|
|
tokenCount, err := LLMMapper.GetTokenCount(summarizeConvoPrompt)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Println(tokenCount)
|
|
}
|