Documentation
¶
Overview ¶
Package client provides support to access the Prediction Guard API service.
Index ¶
- Variables
- func WithClient(http *http.Client) func(cln *Client)
- type Capability
- type Chat
- type ChatChoice
- type ChatMessage
- type ChatSSE
- type ChatSSEChoice
- type ChatSSEDelta
- type ChatVision
- type ChatVisionChoice
- type ChatVisionMessage
- type Client
- type Completion
- type CompletionChoice
- type D
- type Direction
- type Embedding
- type EmbeddingData
- type Error
- type Factuality
- type FactualityCheck
- type ImageBase64
- type ImageFile
- type ImageNetwork
- type Injection
- type InjectionCheck
- type Language
- type Logger
- type ModelCapabilities
- type ModelData
- type ModelResponse
- type PII
- type ReplaceMethod
- type ReplacePII
- type ReplacePIICheck
- type Rerank
- type RerankResult
- type Role
- type SSEClient
- type Time
- type TokenData
- type Tokenize
- type Toxicity
- type ToxicityCheck
- type Translate
- type Translation
Examples ¶
- Client.Do (Capability)
- Client.Do (Chat)
- Client.Do (ChatSSE)
- Client.Do (ChatVision)
- Client.Do (Completions)
- Client.Do (Embedding)
- Client.Do (EmbeddingInts)
- Client.Do (Factuality)
- Client.Do (Injection)
- Client.Do (ReplacePII)
- Client.Do (Rerank)
- Client.Do (Tokenize)
- Client.Do (Toxicity)
- Client.Do (Translate)
Constants ¶
This section is empty.
Variables ¶
View Source
var Capabilities = capabilitySet{
ChatCompletion: newCapability("chat-completion"),
ChatWithImage: newCapability("chat-with-image"),
Completion: newCapability("completion"),
Embedding: newCapability("embedding"),
EmbeddingWithImage: newCapability("embedding-with-image"),
Tokenize: newCapability("tokenize"),
}
Capabilities represents the set of model capabilities.
View Source
var Directions = directionSet{
Right: newDirection("Right"),
Left: newDirection("Left"),
}
View Source
var Languages = languageSet{
Afrikanns: newLanguage("afr"),
Amharic: newLanguage("amh"),
Arabic: newLanguage("ara"),
Armenian: newLanguage("hye"),
Azerbaijan: newLanguage("aze"),
Basque: newLanguage("eus"),
Belarusian: newLanguage("bel"),
Bengali: newLanguage("ben"),
Bosnian: newLanguage("bos"),
Catalan: newLanguage("cat"),
Chechen: newLanguage("che"),
Cherokee: newLanguage("chr"),
Chinese: newLanguage("zho"),
Croatian: newLanguage("hrv"),
Czech: newLanguage("ces"),
Danish: newLanguage("dan"),
Dutch: newLanguage("nld"),
English: newLanguage("eng"),
Estonian: newLanguage("est"),
Fijian: newLanguage("fij"),
Filipino: newLanguage("fil"),
Finnish: newLanguage("fin"),
French: newLanguage("fra"),
Galician: newLanguage("glg"),
Georgian: newLanguage("kat"),
German: newLanguage("deu"),
Greek: newLanguage("ell"),
Gujarati: newLanguage("guj"),
Haitian: newLanguage("hat"),
Hebrew: newLanguage("heb"),
Hindi: newLanguage("hin"),
Hungarian: newLanguage("hun"),
Icelandic: newLanguage("isl"),
Indonesian: newLanguage("ind"),
Irish: newLanguage("gle"),
Italian: newLanguage("ita"),
Japanese: newLanguage("jpn"),
Kannada: newLanguage("kan"),
Kazakh: newLanguage("kaz"),
Korean: newLanguage("kor"),
Latvian: newLanguage("lav"),
Lithuanian: newLanguage("lit"),
Macedonian: newLanguage("mkd"),
Malay1: newLanguage("msa"),
Malay2: newLanguage("zlm"),
Malayalam: newLanguage("mal"),
Maltese: newLanguage("mlt"),
Marathi: newLanguage("mar"),
Nepali: newLanguage("nep"),
Norwegian: newLanguage("nor"),
Persian: newLanguage("fas"),
Polish: newLanguage("pol"),
Portuguese: newLanguage("por"),
Romanian: newLanguage("ron"),
Russian: newLanguage("rus"),
Samoan: newLanguage("smo"),
Serbian: newLanguage("srp"),
Slovak: newLanguage("slk"),
Slovenian: newLanguage("slv"),
Slavonic: newLanguage("chu"),
Spanish: newLanguage("spa"),
Swahili: newLanguage("swh"),
Swedish: newLanguage("swe"),
Tamil: newLanguage("tam"),
Telugu: newLanguage("tel"),
Thai: newLanguage("tha"),
Turkish: newLanguage("tur"),
Ukrainian: newLanguage("ukr"),
Urdu: newLanguage("urd"),
Welsh: newLanguage("cym"),
Vietnamese: newLanguage("vie"),
}
View Source
var PIIs = piiSet{
Block: newPII("block"),
Replace: newPII("replace"),
}
View Source
var ReplaceMethods = replaceMethodSet{
Random: newReplaceMethod("random"),
Fake: newReplaceMethod("fake"),
Category: newReplaceMethod("category"),
Mask: newReplaceMethod("mask"),
}
View Source
var Roles = roleSet{
Assistant: newRole("assistant"),
User: newRole("user"),
System: newRole("system"),
}
Functions ¶
func WithClient ¶
Types ¶
type Capability ¶
type Capability struct {
// contains filtered or unexported fields
}
func (Capability) Equal ¶
func (c Capability) Equal(c2 Capability) bool
func (Capability) MarshalText ¶
func (c Capability) MarshalText() ([]byte, error)
func (Capability) String ¶
func (c Capability) String() string
func (*Capability) UnmarshalText ¶
func (c *Capability) UnmarshalText(data []byte) error
type Chat ¶
type Chat struct { ID string `json:"id"` Object string `json:"object"` Created Time `json:"created"` Model string `json:"model"` Choices []ChatChoice `json:"choices"` }
type ChatChoice ¶
type ChatChoice struct { Index int `json:"index"` Message ChatMessage `json:"message"` }
type ChatMessage ¶
type ChatSSEChoice ¶
type ChatSSEChoice struct { Index int `json:"index"` Delta ChatSSEDelta `json:"delta"` Text string `json:"generated_text"` Probs float32 `json:"logprobs"` FinishReason string `json:"finish_reason"` }
type ChatSSEDelta ¶
type ChatSSEDelta struct {
Content string `json:"content"`
}
type ChatVision ¶
type ChatVision struct { ID string `json:"id"` Object string `json:"object"` Created Time `json:"created"` Model string `json:"model"` Choices []ChatVisionChoice `json:"choices"` }
ChatVision represents the result for the vision call.
type ChatVisionChoice ¶
type ChatVisionChoice struct { Index int `json:"index"` Message ChatVisionMessage `json:"message"` }
ChatVisionChoice represents a choice for the vision call.
type ChatVisionMessage ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Do ¶
Example (Capability) ¶
// examples/capability/main.go ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() logger := func(ctx context.Context, msg string, v ...any) { s := fmt.Sprintf("msg: %s", msg) for i := 0; i < len(v); i = i + 2 { s = s + fmt.Sprintf(", %s: %v", v[i], v[i+1]) } log.Println(s) } cln := client.New(logger, os.Getenv("PREDICTIONGUARD_API_KEY")) // ------------------------------------------------------------------------- url := "https://api.predictionguard.com/models/" + client.Capabilities.ChatCompletion.String() var resp client.ModelResponse if err := cln.Do(ctx, http.MethodGet, url, nil, &resp); err != nil { log.Fatalf("do: %s", err) } fmt.Println(resp)
Example (Chat) ¶
// examples/chat/basic/main.go ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() logger := func(ctx context.Context, msg string, v ...any) { s := fmt.Sprintf("msg: %s", msg) for i := 0; i < len(v); i = i + 2 { s = s + fmt.Sprintf(", %s: %v", v[i], v[i+1]) } log.Println(s) } cln := client.New(logger, os.Getenv("PREDICTIONGUARD_API_KEY")) // ------------------------------------------------------------------------- d := client.D{ "model": "neural-chat-7b-v3-3", "messages": "How do you feel about the world in general", "max_tokens": 1000, "temperature": 0.1, "top_p": 0.1, "top_k": 50, "input": client.D{ "pii": client.PIIs.Replace, "pii_replace_method": client.ReplaceMethods.Random, }, "output": client.D{ "factuality": true, "toxicity": true, }, } // ------------------------------------------------------------------------- const url = "https://api.predictionguard.com/chat/completions" var resp client.Chat if err := cln.Do(ctx, http.MethodPost, url, d, &resp); err != nil { log.Fatalf("do: %s", err) } fmt.Println(resp.Choices[0].Message)
Example (ChatSSE) ¶
// examples/chat/sse/main.go ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() logger := func(ctx context.Context, msg string, v ...any) { s := fmt.Sprintf("msg: %s", msg) for i := 0; i < len(v); i = i + 2 { s = s + fmt.Sprintf(", %s: %v", v[i], v[i+1]) } log.Println(s) } cln := client.NewSSE[client.ChatSSE](logger, os.Getenv("PREDICTIONGUARD_API_KEY")) // ------------------------------------------------------------------------- d := client.D{ "model": "neural-chat-7b-v3-3", "messages": []client.D{ { "role": "user", "content": "How do you feel about the world in general", }, }, "stream": true, "max_tokens": 1000, "temperature": 0.1, "top_p": 0.1, "top_k": 50, "input": client.D{ "pii": client.PIIs.Replace, "pii_replace_method": client.ReplaceMethods.Random, }, } // ------------------------------------------------------------------------- const url = "https://api.predictionguard.com/chat/completions" ch := make(chan client.ChatSSE, 100) if err := cln.Do(ctx, http.MethodPost, url, d, ch); err != nil { log.Fatalf("do: %s", err) } for resp := range ch { if resp.Error != "" { log.Fatalf(resp.Error) } for _, choice := range resp.Choices { fmt.Print(choice.Delta.Content) } }
Example (ChatVision) ¶
// examples/chat/vision/main.go ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() logger := func(ctx context.Context, msg string, v ...any) { s := fmt.Sprintf("msg: %s", msg) for i := 0; i < len(v); i = i + 2 { s = s + fmt.Sprintf(", %s: %v", v[i], v[i+1]) } log.Println(s) } cln := client.New(logger, os.Getenv("PREDICTIONGUARD_API_KEY")) // ------------------------------------------------------------------------- image, err := client.NewImageNetwork("https://static.wixstatic.com/media/f54603_b7882b876e2b47d3a38843a58a9829f1~mv2.png") if err != nil { log.Fatalf("newimage: %s", err) } base64, err := image.EncodeBase64(ctx) if err != nil { log.Fatalf("base64: %s", err) } d := client.D{ "model": "llava-1.5-7b-hf", "messages": []client.D{ { "role": client.Roles.User, "content": []client.D{ { "type": "text", "text": "Is this a picture of a rose?", }, { "type": "image_url", "image_url": client.D{ "url": fmt.Sprintf("data:image/png;base64,%s", base64), }, }, }, }, }, "max_tokens": 1000, "temperature": 0.1, "top_p": 0.1, "top_k": 50, "input": client.D{ "pii": client.PIIs.Replace, "pii_replace_method": client.ReplaceMethods.Random, }, "output": client.D{ "factuality": false, "toxicity": true, }, } // ------------------------------------------------------------------------- const url = "https://api.predictionguard.com/chat/completions" var resp client.ChatVision if err := cln.Do(ctx, http.MethodPost, url, d, &resp); err != nil { log.Fatalf("do: %s", err) } for i, choice := range resp.Choices { fmt.Printf("choice %d: %s\n", i, choice.Message.Content) }
Example (Completions) ¶
// examples/completion/main.go ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() logger := func(ctx context.Context, msg string, v ...any) { s := fmt.Sprintf("msg: %s", msg) for i := 0; i < len(v); i = i + 2 { s = s + fmt.Sprintf(", %s: %v", v[i], v[i+1]) } log.Println(s) } cln := client.New(logger, os.Getenv("PREDICTIONGUARD_API_KEY")) // ------------------------------------------------------------------------- d := client.D{ "model": "neural-chat-7b-v3-3", "prompt": "Will I lose my hair", "max_tokens": 1000, "temperature": 0.1, "top_p": 0.1, "top_k": 50, } // ------------------------------------------------------------------------- const url = "https://api.predictionguard.com/completions" var resp client.Completion if err := cln.Do(ctx, http.MethodPost, url, d, &resp); err != nil { log.Fatalf("do: %s", err) } fmt.Println(resp.Choices[0].Text)
Example (Embedding) ¶
// examples/embedding/basic/main.go ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() logger := func(ctx context.Context, msg string, v ...any) { s := fmt.Sprintf("msg: %s", msg) for i := 0; i < len(v); i = i + 2 { s = s + fmt.Sprintf(", %s: %v", v[i], v[i+1]) } log.Println(s) } cln := client.New(logger, os.Getenv("PREDICTIONGUARD_API_KEY")) // ------------------------------------------------------------------------- image, err := client.NewImageNetwork("https://static.wixstatic.com/media/f54603_b7882b876e2b47d3a38843a58a9829f1~mv2.png") if err != nil { log.Fatalf("newimage: %s", err) } base64, err := image.EncodeBase64(ctx) if err != nil { log.Fatalf("base64: %s", err) } // ------------------------------------------------------------------------- d := client.D{ "model": "bridgetower-large-itm-mlm-itc", "truncate": true, "truncate_direction": client.Directions.Right, "input": []client.D{ { "text": "A picture of a rose", "image": base64, }, }, } // ------------------------------------------------------------------------- const url = "https://api.predictionguard.com/embeddings" var resp client.Embedding if err := cln.Do(ctx, http.MethodPost, url, d, &resp); err != nil { log.Fatalf("do: %s", err) } for _, data := range resp.Data { fmt.Print(data.Embedding) }
Example (EmbeddingInts) ¶
// examples/embedding/ints/main.go ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() logger := func(ctx context.Context, msg string, v ...any) { s := fmt.Sprintf("msg: %s", msg) for i := 0; i < len(v); i = i + 2 { s = s + fmt.Sprintf(", %s: %v", v[i], v[i+1]) } log.Println(s) } cln := client.New(logger, os.Getenv("PREDICTIONGUARD_API_KEY")) // ------------------------------------------------------------------------- d := client.D{ "model": "bridgetower-large-itm-mlm-itc", "truncate": false, "input": [][]int{ {0, 3293, 83, 19893, 118963, 25, 7, 3034, 5, 2}, }, } // ------------------------------------------------------------------------- const url = "https://api.predictionguard.com/embeddings" var resp client.Embedding if err := cln.Do(ctx, http.MethodPost, url, d, &resp); err != nil { log.Fatalf("do: %s", err) } for _, data := range resp.Data { fmt.Print(data.Embedding) }
Example (Factuality) ¶
// examples/factuality/main.go ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() logger := func(ctx context.Context, msg string, v ...any) { s := fmt.Sprintf("msg: %s", msg) for i := 0; i < len(v); i = i + 2 { s = s + fmt.Sprintf(", %s: %v", v[i], v[i+1]) } log.Println(s) } cln := client.New(logger, os.Getenv("PREDICTIONGUARD_API_KEY")) // ------------------------------------------------------------------------- fact := "The President shall receive in full for his services during the term for which he shall have been elected compensation in the aggregate amount of 400,000 a year, to be paid monthly, and in addition an expense allowance of 50,000 to assist in defraying expenses relating to or resulting from the discharge of his official duties. Any unused amount of such expense allowance shall revert to the Treasury pursuant to section 1552 of title 31, United States Code. No amount of such expense allowance shall be included in the gross income of the President. He shall be entitled also to the use of the furniture and other effects belonging to the United States and kept in the Executive Residence at the White House." text := "The president of the united states can take a salary of one million dollars" d := client.D{ "reference": fact, "text": text, } // ------------------------------------------------------------------------- const url = "https://api.predictionguard.com/factuality" var resp client.Factuality if err := cln.Do(ctx, http.MethodPost, url, d, &resp); err != nil { log.Fatalf("do: %s", err) } fmt.Println(resp.Checks[0])
Example (Injection) ¶
// examples/injection/main.go ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() logger := func(ctx context.Context, msg string, v ...any) { s := fmt.Sprintf("msg: %s", msg) for i := 0; i < len(v); i = i + 2 { s = s + fmt.Sprintf(", %s: %v", v[i], v[i+1]) } log.Println(s) } cln := client.New(logger, os.Getenv("PREDICTIONGUARD_API_KEY")) // ------------------------------------------------------------------------- prompt := "A short poem may be a stylistic choice or it may be that you have said what you intended to say in a more concise way." d := client.D{ "prompt": prompt, "detect": true, } // ------------------------------------------------------------------------- const url = "https://api.predictionguard.com/injection" var resp client.Injection if err := cln.Do(ctx, http.MethodPost, url, d, &resp); err != nil { log.Fatalf("do: %s", err) } fmt.Println(resp.Checks[0].Probability)
Example (ReplacePII) ¶
// examples/ReplacePII/main.go ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() logger := func(ctx context.Context, msg string, v ...any) { s := fmt.Sprintf("msg: %s", msg) for i := 0; i < len(v); i = i + 2 { s = s + fmt.Sprintf(", %s: %v", v[i], v[i+1]) } log.Println(s) } cln := client.New(logger, os.Getenv("PREDICTIONGUARD_API_KEY")) // ------------------------------------------------------------------------- prompt := "My email is bill@ardanlabs.com and my number is 954-123-4567." d := client.D{ "prompt": prompt, "replace": true, "replace_method": "mask", } // ------------------------------------------------------------------------- const url = "https://api.predictionguard.com/PII" var resp client.ReplacePII if err := cln.Do(ctx, http.MethodPost, url, d, &resp); err != nil { log.Fatalf("do: %s", err) } fmt.Println(resp.Checks[0].NewPrompt)
Example (Rerank) ¶
// examples/rerank/main.go ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() logger := func(ctx context.Context, msg string, v ...any) { s := fmt.Sprintf("msg: %s", msg) for i := 0; i < len(v); i = i + 2 { s = s + fmt.Sprintf(", %s: %v", v[i], v[i+1]) } log.Println(s) } cln := client.New(logger, os.Getenv("PREDICTIONGUARD_API_KEY")) // ------------------------------------------------------------------------- d := client.D{ "model": "bge-reranker-v2-m3", "query": "What is Deep Learning?", "documents": []string{"Deep Learning is not pizza.", "Deep Learning is pizza."}, "return_documents": true, } // ------------------------------------------------------------------------- const url = "https://api.predictionguard.com/rerank" var resp client.Rerank if err := cln.Do(ctx, http.MethodPost, url, d, &resp); err != nil { log.Fatalf("do: %s", err) } fmt.Println(resp.Results)
Example (Tokenize) ¶
// examples/tokenize/main.go ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() logger := func(ctx context.Context, msg string, v ...any) { s := fmt.Sprintf("msg: %s", msg) for i := 0; i < len(v); i = i + 2 { s = s + fmt.Sprintf(", %s: %v", v[i], v[i+1]) } log.Println(s) } cln := client.New(logger, os.Getenv("PREDICTIONGUARD_API_KEY")) // ------------------------------------------------------------------------- d := client.D{ "model": "neural-chat-7b-v3-3", "input": "how many tokens exist for this sentence.", } // ------------------------------------------------------------------------- const url = "https://api.predictionguard.com/tokenize" var resp client.Tokenize if err := cln.Do(ctx, http.MethodPost, url, d, &resp); err != nil { log.Fatalf("do: %s", err) } fmt.Println(resp)
Example (Toxicity) ¶
// examples/toxicity/main.go ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() logger := func(ctx context.Context, msg string, v ...any) { s := fmt.Sprintf("msg: %s", msg) for i := 0; i < len(v); i = i + 2 { s = s + fmt.Sprintf(", %s: %v", v[i], v[i+1]) } log.Println(s) } cln := client.New(logger, os.Getenv("PREDICTIONGUARD_API_KEY")) // ------------------------------------------------------------------------- d := client.D{ "text": "Every flight I have is late and I am very angry. I want to hurt someone.", } // ------------------------------------------------------------------------- const url = "https://api.predictionguard.com/toxicity" var resp client.Toxicity if err := cln.Do(ctx, http.MethodPost, url, d, &resp); err != nil { log.Fatalf("do: %s", err) } fmt.Println(resp.Checks[0].Score)
Example (Translate) ¶
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() logger := func(ctx context.Context, msg string, v ...any) { s := fmt.Sprintf("msg: %s", msg) for i := 0; i < len(v); i = i + 2 { s = s + fmt.Sprintf(", %s: %v", v[i], v[i+1]) } log.Println(s) } cln := client.New(logger, os.Getenv("PREDICTIONGUARD_API_KEY")) // ------------------------------------------------------------------------- d := client.D{ "text": "The rain in Spain stays mainly in the plain", "source_lang": client.Languages.English, "target_lang": client.Languages.Spanish, "use_third_party_engine": false, } // ------------------------------------------------------------------------- const url = "https://api.predictionguard.com/translate" var resp client.Translate if err := cln.Do(ctx, http.MethodPost, url, d, &resp); err != nil { log.Fatalf("do: %s", err) } fmt.Println(resp.BestTranslation)
type Completion ¶
type Completion struct { ID string `json:"id"` Object string `json:"object"` Created Time `json:"created"` Model string `json:"model"` Choices []CompletionChoice `json:"choices"` }
type CompletionChoice ¶
type Direction ¶
type Direction struct {
// contains filtered or unexported fields
}
func (Direction) MarshalText ¶
func (*Direction) UnmarshalText ¶
type Embedding ¶
type Embedding struct { ID string `json:"id"` Object string `json:"object"` Created Time `json:"created"` Model string `json:"model"` Data []EmbeddingData `json:"data"` }
type EmbeddingData ¶
type Factuality ¶
type Factuality struct { ID string `json:"id"` Object string `json:"object"` Created Time `json:"created"` Checks []FactualityCheck `json:"checks"` }
type FactualityCheck ¶
type ImageBase64 ¶
type ImageBase64 struct {
// contains filtered or unexported fields
}
func NewImageBase64 ¶
func NewImageBase64(base64 string) ImageBase64
func (ImageBase64) EncodeBase64 ¶
func (img ImageBase64) EncodeBase64(ctx context.Context) (string, error)
type ImageFile ¶
type ImageFile struct {
// contains filtered or unexported fields
}
func NewImageFile ¶
type ImageNetwork ¶
type ImageNetwork struct {
// contains filtered or unexported fields
}
func NewImageNetwork ¶
func NewImageNetwork(imageURL string) (ImageNetwork, error)
func (ImageNetwork) EncodeBase64 ¶
func (img ImageNetwork) EncodeBase64(ctx context.Context) (string, error)
type Injection ¶
type Injection struct { ID string `json:"id"` Object string `json:"object"` Created Time `json:"created"` Checks []InjectionCheck `json:"checks"` }
type InjectionCheck ¶
type Language ¶
type Language struct {
// contains filtered or unexported fields
}
func (Language) MarshalText ¶
func (*Language) UnmarshalText ¶
type ModelCapabilities ¶
type ModelData ¶
type ModelData struct { ID string `json:"id"` Object string `json:"object"` Created time.Time `json:"created"` OwnedBy string `json:"owned_by"` Description string `json:"description"` MaxContextLength int `json:"max_context_length"` PromptFormat string `json:"prompt_format"` Capabilities ModelCapabilities `json:"capabilities"` }
type ModelResponse ¶
type PII ¶
type PII struct {
// contains filtered or unexported fields
}
func (PII) MarshalText ¶
func (*PII) UnmarshalText ¶
type ReplaceMethod ¶
type ReplaceMethod struct {
// contains filtered or unexported fields
}
func (ReplaceMethod) Equal ¶
func (rm ReplaceMethod) Equal(rm2 ReplaceMethod) bool
func (ReplaceMethod) MarshalText ¶
func (rm ReplaceMethod) MarshalText() ([]byte, error)
func (ReplaceMethod) String ¶
func (rm ReplaceMethod) String() string
func (*ReplaceMethod) UnmarshalText ¶
func (rm *ReplaceMethod) UnmarshalText(data []byte) error
type ReplacePII ¶
type ReplacePII struct { ID string `json:"id"` Object string `json:"object"` Created Time `json:"created"` Checks []ReplacePIICheck `json:"checks"` }
type ReplacePIICheck ¶
type Rerank ¶
type Rerank struct { ID string `json:"id"` Object string `json:"object"` Created Time `json:"created"` Model string `json:"model"` Results []RerankResult `json:"results"` }
type RerankResult ¶
type Role ¶
type Role struct {
// contains filtered or unexported fields
}
func (Role) MarshalText ¶
func (*Role) UnmarshalText ¶
type Toxicity ¶
type Toxicity struct { ID string `json:"id"` Object string `json:"object"` Created Time `json:"created"` Checks []ToxicityCheck `json:"checks"` }
type ToxicityCheck ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.