123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- package fastgpt
- /**
- 以下为知识库相关
- */
- //var info DatasetReq
- //info.ParentID = "66cc44d725aea7116ded5281"
- //info.Name = "dataset-测试数据(huaguo)"
- //info.Intro = "测试数据(huaguo)"
- //info.AgentModel = "gpt-3.5-turbo"
- //info.VectorModel = "text-embedding-ada-002"
- //
- //var dataset *DatasetResp
- //dataset, err := CreateDataset(&info)
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- // return
- //}
- //fmt.Printf("%v", dataset)
- //fmt.Println(dataset.Code, dataset.StatusText, dataset.Message, dataset.Data)
- //resp, err := DeleteDataset("66cc43e125aea7116ded514f")
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- //}
- //fmt.Printf("code=%v, data=%v, message=%v, statusText=%v", resp.Code, resp.Data, resp.Message, resp.StatusText)
- //resp, err := GetDatasetDetail("66cc44d725aea7116ded5281")
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- //}
- //fmt.Printf("code=%v, data=%v, message=%v, statusText=%v", resp.Code, resp.Data, resp.Message, resp.StatusText)
- //resp, err := GetDatasetList("66cc44d725aea7116ded5281")
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- //}
- //fmt.Printf("%v", resp)
- //resp, err := GetCollectionDetail("66cc458925aea7116ded53bc")
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- //}
- //fmt.Printf("code=%v, data=%v", resp.Code, resp.Data)
- /**
- 以下为集合相关
- */
- //var params GetCollectionListReq
- //params.DatasetId = "66cc458925aea7116ded53ba"
- //params.PageNum = 1
- //params.PageSize = 20
- //resp, err := GetCollectionList(¶ms)
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- //}
- //fmt.Printf("code=%v, data=%v", resp.Code, resp.Data)
- //var params CreateCollectionReq
- //params.DatasetId = "66cc458925aea7116ded53ba"
- //params.Name = "空集合v3"
- //params.Type = "folder"
- //resp, err := CreateEmptyCollection(¶ms)
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- //}
- //fmt.Printf("%v", resp)
- //var params CreateTextCollectionReq
- //params.DatasetId = "66cc458925aea7116ded53ba"
- //params.Name = "文本测试训练v5"
- //params.Text = " 《毒战》改编自杜琪峰执导的同名电影,讲述为了抓捕韩国最大规模贩毒组织的神秘大BOSS李先生,警察元浩与李先生手下成员乐联手破案的故事。 "
- //params.TrainingType = "qa"
- //params.ChunkSize = 8000
- //params.ChunkSplitter = ""
- //params.QaPrompt = "11"
- //resp, err := CreateTextCollection(¶ms)
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- //}
- //fmt.Printf("%v", resp)
- //var params CreateLinkCollectionReq
- //params.DatasetId = "66cc458925aea7116ded53ba"
- //params.Name = "链接测试训练v5"
- //params.Link = "https://doc.in/docs/course/quick-start/"
- //params.TrainingType = "chunk"
- //params.ChunkSize = 512
- //params.ChunkSplitter = ""
- //params.QaPrompt = ""
- //metadata := make(map[string]string)
- //metadata["webPageSelector"] = ".docs-content"
- //params.Metadata = metadata
- //resp, err := CreateLinkCollection(¶ms)
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- //}
- //fmt.Printf("collectionId=%v", resp.Data.CollectionID)
- //data := make(map[string]string, 8)
- //filePath := "/tmp/movie.txt"
- //data["datasetId"] = "66cc458925aea7116ded53ba"
- //data["trainingType"] = "chunk"
- //data["chunkSize"] = "512"
- //data["chunkSplitter"] = ""
- //data["qaPrompt"] = ""
- //resp, err := CreateFileCollection(&data, filePath)
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- //}
- //fmt.Printf("%v", resp)
- //var params UpdateCollectionReq
- //params.ID = "66cd6c0025aea7116dedb313"
- //params.Name = "链接集合V6"
- //resp, err := UpdateCollection(¶ms)
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- //}
- //fmt.Printf("resp=%v", resp)
- //resp, err := DeleteCollection("66cd6c0025aea7116dedb313")
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- //}
- //fmt.Printf("resp=%v", resp)
- /**
- 以下为数据相关
- */
- //resp, err := GetDataDetail("66cd773b25aea7116dedc017")
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- //}
- //fmt.Printf("resp=%v", resp)
- //var params GetDataListReq
- //params.PageSize = 10
- //params.PageNum = 1
- //params.CollectionId = "66cd773b25aea7116dedc01a"
- //resp, err := GetDataList(¶ms)
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- //}
- //fmt.Printf("resp=%v", resp)
- //var params CreateBulkDataReq
- //params.CollectionID = "66cd773b25aea7116dedc01a"
- //params.TrainingMode = "chunk"
- //params.Data = []DataQuestion{
- // {
- // Q: "你是谁?",
- // A: "我是FastGPT助手",
- // },
- // {
- // Q: "你会什么?",
- // A: "我什么都会",
- // Indexes: []Index{
- // {Text: "自定义索引1"},
- // {Text: "自定义索引2"},
- // },
- // },
- //}
- //resp, err := CreateBulkData(¶ms)
- //if err != nil {
- // fmt.Printf("%v", err.Error())
- //}
- //fmt.Printf("resp=%v", resp)
- //var params UpdateDataReq
- //params.ID = "66cd7e1925aea7116dedc64b"
- //params.Q = "你是谁3?"
- //params.A = "我是FastGPT助手3"
- //params.Indexes = []Index{
- // {Text: "自定义索引1", DataId: "66cd7e1925aea7116dedc64b", DefaultIndex: true},
- // {Text: "自定义索引2", DataId: "66cd7e1925aea7116dedc64b", DefaultIndex: false},
- //}
- //resp, err := UpdateData(¶ms)
- //if err != nil {
- // fmt.Printf("%v", err)
- //}
- //fmt.Printf("resp=%v", resp)
- //resp, err := DeleteData("66cd7e1925aea7116dedc651")
- //if err != nil {
- // fmt.Printf("%v", err)
- //}
- //fmt.Printf("resp=%v", resp)
- /**
- 以下为搜索相关
- */
- //var params SearchReq
- //params.DatasetID = "66cc458925aea7116ded53ba"
- //params.Text = "毒战"
- //params.Limit = 20
- //params.SearchMode = "fullTextRecall"
- //params.UsingReRank = true
- //resp, err := SearchText(¶ms)
- //if err != nil {
- // fmt.Printf("%v", err)
- //}
- //fmt.Printf("resp=%v", resp)
|