chatcompletionunified

package
v9.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Perform chat completion inference

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildPath = errors.New("cannot build path, check for missing path parameters")

ErrBuildPath is returned in case of missing parameters within the build of the request.

Functions

This section is empty.

Types

type ChatCompletionUnified

type ChatCompletionUnified struct {
	// contains filtered or unexported fields
}

func (ChatCompletionUnified) Do

func (r ChatCompletionUnified) Do(providedCtx context.Context) (Response, error)

Do runs the request through the transport, handle the response and returns a chatcompletionunified.Response

func (*ChatCompletionUnified) ErrorTrace

func (r *ChatCompletionUnified) ErrorTrace(errortrace bool) *ChatCompletionUnified

ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errors when they occur. API name: error_trace

func (*ChatCompletionUnified) FilterPath

func (r *ChatCompletionUnified) FilterPath(filterpaths ...string) *ChatCompletionUnified

FilterPath Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch. API name: filter_path

func (*ChatCompletionUnified) Header

func (r *ChatCompletionUnified) Header(key, value string) *ChatCompletionUnified

Header set a key, value pair in the ChatCompletionUnified headers map.

func (*ChatCompletionUnified) HttpRequest

func (r *ChatCompletionUnified) HttpRequest(ctx context.Context) (*http.Request, error)

HttpRequest returns the http.Request object built from the given parameters.

func (*ChatCompletionUnified) Human

Human When set to `true` will return statistics in a format suitable for humans. For example `"exists_time": "1h"` for humans and `"eixsts_time_in_millis": 3600000` for computers. When disabled the human readable values will be omitted. This makes sense for responses being consumed only by machines. API name: human

func (*ChatCompletionUnified) MaxCompletionTokens

func (r *ChatCompletionUnified) MaxCompletionTokens(maxcompletiontokens int64) *ChatCompletionUnified

The upper bound limit for the number of tokens that can be generated for a completion request. API name: max_completion_tokens

func (*ChatCompletionUnified) Messages

A list of objects representing the conversation. API name: messages

func (*ChatCompletionUnified) Model

The ID of the model to use. API name: model

func (ChatCompletionUnified) Perform

func (r ChatCompletionUnified) Perform(providedCtx context.Context) (*http.Response, error)

Perform runs the http.Request through the provided transport and returns an http.Response.

func (*ChatCompletionUnified) Pretty

Pretty If set to `true` the returned JSON will be "pretty-formatted". Only use this option for debugging only. API name: pretty

func (*ChatCompletionUnified) Raw

Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.

func (*ChatCompletionUnified) Request

Request allows to set the request property with the appropriate payload.

func (*ChatCompletionUnified) Stop

A sequence of strings to control when the model should stop generating additional tokens. API name: stop

func (*ChatCompletionUnified) Temperature

func (r *ChatCompletionUnified) Temperature(temperature float32) *ChatCompletionUnified

The sampling temperature to use. API name: temperature

func (*ChatCompletionUnified) Timeout

func (r *ChatCompletionUnified) Timeout(duration string) *ChatCompletionUnified

Timeout Specifies the amount of time to wait for the inference request to complete. API name: timeout

func (*ChatCompletionUnified) ToolChoice

Controls which tool is called by the model. API name: tool_choice

func (*ChatCompletionUnified) Tools

A list of tools that the model can call. API name: tools

func (*ChatCompletionUnified) TopP

Nucleus sampling, an alternative to sampling with temperature. API name: top_p

type NewChatCompletionUnified

type NewChatCompletionUnified func(inferenceid string) *ChatCompletionUnified

NewChatCompletionUnified type alias for index.

func NewChatCompletionUnifiedFunc

func NewChatCompletionUnifiedFunc(tp elastictransport.Interface) NewChatCompletionUnified

NewChatCompletionUnifiedFunc returns a new instance of ChatCompletionUnified with the provided transport. Used in the index of the library this allows to retrieve every apis in once place.

type Request

type Request = types.RequestChatCompletion

Request holds the request body struct for the package chatcompletionunified

https://github.com/elastic/elasticsearch-specification/blob/52c473efb1fb5320a5bac12572d0b285882862fb/specification/inference/chat_completion_unified/UnifiedRequest.ts#L24-L53

func NewRequest

func NewRequest() *Request

NewRequest returns a Request

type Response

type Response = []byte

func NewResponse

func NewResponse() Response

NewResponse returns a Response

close