utils

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ManyCompletions

func ManyCompletions(
	ctx context.Context,
	providers []provider.IProvider,
	options ...provider.Func) (map[string]string, error,
)

ManyCompletions generates one or more completions. It returns a map of the provider and its respective response. The response is a string. Use this method for simple, and straightforward completions.

NOTE: Not all options are available for all providers.

NOTE: Do not pass WithResponseBody, it will not be used, and the content will be wrong.

SEE: utils_test.go for example.

func TypedManyCompletions

func TypedManyCompletions[T any](
	ctx context.Context,
	providers []provider.IProvider,
	options ...provider.Func) (map[string]T, error,
)

TypedManyCompletions generates one or more completions. It returns a map correlating the provider and its respective response. The response `T`, is whatever the developer specified. This method is a more powerful, and flexible version of ManyCompletions. Use this in cases where the response is not a string, but needs to be unmarshalled (processed).

NOTE: Not all options are available for all providers.

NOTE: Do not pass WithResponseBody, it will not be used, and the content will be wrong.

SEE: utils_test.go for example.

Types

This section is empty.

Jump to

Keyboard shortcuts

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