Documentation
¶
Index ¶
- type Client
- func (hf *Client) Summarization(ctx context.Context, req *SummarizationRequest) (*SummarizationResponse, error)
- func (hf *Client) Text2TextGeneration(ctx context.Context, req *Text2TextGenerationRequest) (Text2TextGenerationResponse, error)
- func (hf *Client) TextGeneration(ctx context.Context, req *TextGenerationRequest) (TextGenerationResponse, error)
- type ErrorResponse
- type Options
- type SummarizationParameters
- type SummarizationRequest
- type SummarizationResponse
- type Text2TextGenerationParameters
- type Text2TextGenerationRequest
- type Text2TextGenerationResponse
- type TextGenerationParameters
- type TextGenerationRequest
- type TextGenerationResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Summarization ¶
func (hf *Client) Summarization(ctx context.Context, req *SummarizationRequest) (*SummarizationResponse, error)
func (*Client) Text2TextGeneration ¶
func (hf *Client) Text2TextGeneration(ctx context.Context, req *Text2TextGenerationRequest) (Text2TextGenerationResponse, error)
func (*Client) TextGeneration ¶
func (hf *Client) TextGeneration(ctx context.Context, req *TextGenerationRequest) (TextGenerationResponse, error)
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
type Options ¶
type Options struct { // (Default: true). There is a cache layer on the inference API to speedup // requests we have already seen. Most models can use those results as is // as models are deterministic (meaning the results will be the same anyway). // However if you use a non deterministic model, you can set this parameter // to prevent the caching mechanism from being used resulting in a real new query. UseCache *bool `json:"use_cache,omitempty"` // (Default: false) If the model is not ready, wait for it instead of receiving 503. // It limits the number of requests required to get your inference done. It is advised // to only set this flag to true after receiving a 503 error as it will limit hanging // in your application to known places. WaitForModel *bool `json:"wait_for_model,omitempty"` }
type SummarizationParameters ¶
type SummarizationParameters struct { // (Default: None). Integer to define the minimum length in tokens of the output summary. MinLength *int `json:"min_length,omitempty"` // (Default: None). Integer to define the maximum length in tokens of the output summary. MaxLength *int `json:"max_length,omitempty"` // (Default: None). Integer to define the top tokens considered within the sample operation to create // new text. TopK *int `json:"top_k,omitempty"` // (Default: None). Float to define the tokens that are within the sample` operation of text generation. // Add tokens in the sample for more probable to least probable until the sum of the probabilities is // greater than top_p. TopP *float64 `json:"top_p,omitempty"` // (Default: 1.0). Float (0.0-100.0). The temperature of the sampling operation. 1 means regular sampling, // 0 mens top_k=1, 100.0 is getting closer to uniform probability. Temperature *float64 `json:"temperature,omitempty"` // (Default: None). Float (0.0-100.0). The more a token is used within generation the more it is penalized // to not be picked in successive generation passes. RepetitionPenalty *float64 `json:"repetitionpenalty,omitempty"` // (Default: None). Float (0-120.0). The amount of time in seconds that the query should take maximum. // Network can cause some overhead so it will be a soft limit. MaxTime *float64 `json:"maxtime,omitempty"` }
type SummarizationRequest ¶
type SummarizationRequest struct { // String to be summarized Inputs string `json:"inputs"` Parameters SummarizationParameters `json:"parameters,omitempty"` Options Options `json:"options,omitempty"` }
type SummarizationResponse ¶
type SummarizationResponse struct { // The summarized input string SummaryText string `json:"summary_text,omitempty"` }
type Text2TextGenerationParameters ¶
type Text2TextGenerationParameters struct { // (Default: None). Integer to define the top tokens considered within the sample operation to create new text. TopK *int `json:"top_k,omitempty"` // (Default: None). Float to define the tokens that are within the sample` operation of text generation. Add // tokens in the sample for more probable to least probable until the sum of the probabilities is greater // than top_p. TopP *float64 `json:"top_p,omitempty"` // (Default: 1.0). Float (0.0-100.0). The temperature of the sampling operation. 1 means regular sampling, // 0 means top_k=1, 100.0 is getting closer to uniform probability. Temperature *float64 `json:"temperature,omitempty"` // (Default: None). Float (0.0-100.0). The more a token is used within generation the more it is penalized // to not be picked in successive generation passes. RepetitionPenalty *float64 `json:"repetition_penalty,omitempty"` // (Default: None). Int (0-250). The amount of new tokens to be generated, this does not include the input // length it is a estimate of the size of generated text you want. Each new tokens slows down the request, // so look for balance between response times and length of text generated. MaxNewTokens *int `json:"max_new_tokens,omitempty"` // (Default: None). Float (0-120.0). The amount of time in seconds that the query should take maximum. // Network can cause some overhead so it will be a soft limit. Use that in combination with max_new_tokens // for best results. MaxTime *float64 `json:"max_time,omitempty"` // (Default: True). Bool. If set to False, the return results will not contain the original query making it // easier for prompting. ReturnFullText *bool `json:"return_full_text,omitempty"` // (Default: 1). Integer. The number of proposition you want to be returned. NumReturnSequences *int `json:"num_return_sequences,omitempty"` }
type Text2TextGenerationRequest ¶
type Text2TextGenerationRequest struct { // String to generated from Inputs string `json:"inputs"` Parameters Text2TextGenerationParameters `json:"parameters,omitempty"` Options Options `json:"options,omitempty"` }
type Text2TextGenerationResponse ¶
type Text2TextGenerationResponse []struct { GeneratedText string `json:"generated_text,omitempty"` }
type TextGenerationParameters ¶
type TextGenerationParameters struct { // (Default: None). Integer to define the top tokens considered within the sample operation to create new text. TopK *int `json:"top_k,omitempty"` // (Default: None). Float to define the tokens that are within the sample` operation of text generation. Add // tokens in the sample for more probable to least probable until the sum of the probabilities is greater // than top_p. TopP *float64 `json:"top_p,omitempty"` // (Default: 1.0). Float (0.0-100.0). The temperature of the sampling operation. 1 means regular sampling, // 0 means top_k=1, 100.0 is getting closer to uniform probability. Temperature *float64 `json:"temperature,omitempty"` // (Default: None). Float (0.0-100.0). The more a token is used within generation the more it is penalized // to not be picked in successive generation passes. RepetitionPenalty *float64 `json:"repetition_penalty,omitempty"` // (Default: None). Int (0-250). The amount of new tokens to be generated, this does not include the input // length it is a estimate of the size of generated text you want. Each new tokens slows down the request, // so look for balance between response times and length of text generated. MaxNewTokens *int `json:"max_new_tokens,omitempty"` // (Default: None). Float (0-120.0). The amount of time in seconds that the query should take maximum. // Network can cause some overhead so it will be a soft limit. Use that in combination with max_new_tokens // for best results. MaxTime *float64 `json:"max_time,omitempty"` // (Default: True). Bool. If set to False, the return results will not contain the original query making it // easier for prompting. ReturnFullText *bool `json:"return_full_text,omitempty"` // (Default: 1). Integer. The number of proposition you want to be returned. NumReturnSequences *int `json:"num_return_sequences,omitempty"` }
type TextGenerationRequest ¶
type TextGenerationRequest struct { // String to generated from Inputs string `json:"inputs"` Parameters TextGenerationParameters `json:"parameters,omitempty"` Options Options `json:"options,omitempty"` }
type TextGenerationResponse ¶
type TextGenerationResponse []struct { GeneratedText string `json:"generated_text,omitempty"` }
A list of generated texts. The length of this list is the value of NumReturnSequences in the request.
Click to show internal directories.
Click to hide internal directories.