Add docs
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CompletionRequest represents a request structure for competion API
|
||||||
type CompletionRequest struct {
|
type CompletionRequest struct {
|
||||||
Prompt string `json:"prompt,omitempty"`
|
Prompt string `json:"prompt,omitempty"`
|
||||||
MaxTokens int `json:"max_tokens,omitempty"`
|
MaxTokens int `json:"max_tokens,omitempty"`
|
||||||
@@ -26,6 +27,7 @@ type CompletionRequest struct {
|
|||||||
FrequencyPenalty float32 `json:"frequency_penalty,omitempty"`
|
FrequencyPenalty float32 `json:"frequency_penalty,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Choice represents one of possible completions
|
||||||
type Choice struct {
|
type Choice struct {
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
Index int `json:"index"`
|
Index int `json:"index"`
|
||||||
@@ -33,6 +35,7 @@ type Choice struct {
|
|||||||
LogProbs LogprobResult `json:"logprobs"`
|
LogProbs LogprobResult `json:"logprobs"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LogprobResult represents logprob result of Choice
|
||||||
type LogprobResult struct {
|
type LogprobResult struct {
|
||||||
Tokens []string `json:"tokens"`
|
Tokens []string `json:"tokens"`
|
||||||
TokenLogprobs []float32 `json:"token_logprobs"`
|
TokenLogprobs []float32 `json:"token_logprobs"`
|
||||||
@@ -40,6 +43,7 @@ type LogprobResult struct {
|
|||||||
TextOffset []int `json:"text_offset"`
|
TextOffset []int `json:"text_offset"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CompletionResponse represents a response structure for competion API
|
||||||
type CompletionResponse struct {
|
type CompletionResponse struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Object string `json:"object"`
|
Object string `json:"object"`
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Engine struct represents engine from OpenAPI API
|
||||||
type Engine struct {
|
type Engine struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Object string `json:"object"`
|
Object string `json:"object"`
|
||||||
@@ -13,6 +14,7 @@ type Engine struct {
|
|||||||
Ready bool `json:"ready"`
|
Ready bool `json:"ready"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EnginesList is a list of engines
|
||||||
type EnginesList struct {
|
type EnginesList struct {
|
||||||
Engines []Engine `json:"data"`
|
Engines []Engine `json:"data"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,16 +8,19 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// SearchRequest represents a request structure for search API
|
||||||
type SearchRequest struct {
|
type SearchRequest struct {
|
||||||
Documents []string `json:"documents"`
|
Documents []string `json:"documents"`
|
||||||
Query string `json:"query"`
|
Query string `json:"query"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SearchResult represents single result from search API
|
||||||
type SearchResult struct {
|
type SearchResult struct {
|
||||||
Document int `json:"document"`
|
Document int `json:"document"`
|
||||||
Score float32 `json:"score"`
|
Score float32 `json:"score"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SearchResponse represents a response structure for search API
|
||||||
type SearchResponse struct {
|
type SearchResponse struct {
|
||||||
SearchResults []SearchResult `json:"data"`
|
SearchResults []SearchResult `json:"data"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user