rag

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Copyright 2024 KubeAGI. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to 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. See the License for the specific language governing permissions and limitations under the License.

Copyright 2024 KubeAGI.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to 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. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRAG

func CreateRAG(ctx context.Context, kubeClient client.Client, input *generated.CreateRAGInput) (*generated.Rag, error)

func DeleteRAG

func DeleteRAG(ctx context.Context, kubeClient client.Client, input *generated.DeleteRAGInput) error

func DuplicateRAG

func DuplicateRAG(ctx context.Context, kubeClient client.Client, input *generated.DuplicateRAGInput) (*generated.Rag, error)

func GetRAG

func GetRAG(ctx context.Context, kubeClient client.Client, name, namespace string) (*generated.Rag, error)

func GetRAGDatasets

func GetRAGDatasets(ctx context.Context, kubeClient client.Client, name, namespace string) ([]*generated.RAGDataset, error)

func GetRAGMetrics

func GetRAGMetrics(ctx context.Context, kubeClient client.Client, name, namespace string) ([]*generated.RAGMetric, error)

func GetV1alpha1RAG

func GetV1alpha1RAG(ctx context.Context, kubeClient client.Client, name, namespace string) (*evav1alpha1.RAG, error)

func ListRAG

func ListRAG(ctx context.Context, kubeClient client.Client, input *generated.ListRAGInput) (*generated.PaginatedResult, error)

func UpdateRAG

func UpdateRAG(ctx context.Context, kubeClient client.Client, input *generated.UpdateRAGInput) (*generated.Rag, error)

Types

type RadarData

type RadarData struct {
	Type  string  `json:"type"`
	Value float64 `json:"value"`
	Color string  `json:"color"`
}

type Report

type Report struct {
	RadarChart []RadarData    `json:"radarChart"`
	TotalScore TotalScoreData `json:"totalScore"`

	// TODO
	Summary string `json:"summary"`
}

func ParseSummary

func ParseSummary(
	ctx context.Context,
	appName, ragName, namespace string,
	metricThresholds map[string]float64,
) (Report, error)

type ReportDetail

type ReportDetail struct {
	Data  []ReportLine `json:"data"`
	Total int          `json:"total"`
}

func ParseResult

func ParseResult(
	ctx context.Context,
	page, pageSize int,
	appName, ragName, namespace, sortBy, order string,
) (ReportDetail, error)

type ReportLine

type ReportLine struct {
	Question     string             `json:"question"`
	GroundTruths []string           `json:"groundTruths"`
	Answer       string             `json:"answer"`
	Contexts     []string           `json:"contexts"`
	Data         map[string]float64 `json:"data"`
	TotalScore   float64            `json:"totalScore"`
	CostTime     float64            `json:"costTime"`
}

忠实度、答案相关度、答案语义相似度、答案正确性、知识库相关度、知识库精度、知识库相似度 question,ground_truths,answer,contexts,latency

type ScatterData

type ScatterData struct {
	Score    float64 `json:"score"`
	CostTime float64 `json:"costTime"`
}

func PraseScatterChart

func PraseScatterChart(ctx context.Context, appName, ragName, namespace string) ([]ScatterData, error)

type TotalScoreData

type TotalScoreData struct {
	Score float64 `json:"score"`
	Color string  `json:"color"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL