Go API Documentation

github.com/TScafeJR/genai/deepseek

Package deepseek provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.

Package

Files: 3. Third party imports: 1. Imports from organisation: 0. Tests: 0. Benchmarks: 0.

Types

Cfg

This type doesn't have documentation.

Field name Field type Comment
Logger

*zap.Logger

No comment on field.
ApiKey

string

No comment on field.
Models

Models

No comment on field.
Local

bool

No comment on field.
HttpClient

*http.Client

No comment on field.

Client

Client which conforms to the OpenAPI3 specification for this service.

Field name Field type Comment
Server

string

The endpoint of the server conforming to this interface, with scheme, https://api.deepmap.com for example. This can contain a path relative to the server, such as https://api.deepmap.com/dev-test, and all the paths in the swagger spec will be appended to the server.

Client

HttpRequestDoer

Doer for performing requests, typically a *http.Client with any customized settings, such as certificate chains.

RequestEditors

[]RequestEditorFn

A list of callbacks for modifying requests which are generated before sending over the network.

ClientInterface

The interface specification for the client above.

Field name Field type Comment
type

any

No comment on field.

ClientOption

ClientOption allows setting custom parameters during construction

Field name Field type Comment
type

func(*Client) error

No comment on field.

ClientWithResponses

ClientWithResponses builds on ClientInterface to offer response payloads

Field name Field type Comment

ClientInterface

No comment on field.

ClientWithResponsesInterface

ClientWithResponsesInterface is the interface specification for the client with responses above.

Field name Field type Comment
type

any

No comment on field.

DeepseekClient

This type doesn't have documentation.

Field name Field type Comment
logger

*zap.Logger

No comment on field.
client

*Client

No comment on field.
url

string

No comment on field.
httpClient

*http.Client

No comment on field.
apiKey

string

No comment on field.

GenerateContentJSONBody

GenerateContentJSONBody defines parameters for GenerateContent.

Field name Field type Comment
Options

*struct { // MaxTokens Maximum number of tokens to generate. MaxTokens *int `json:"max_tokens,omitempty"` // Temperature Sampling temperature, between 0 and 1. Temperature *float32 `json:"temperature,omitempty"` }

Options Optional settings for content generation.

Prompt

*string

Prompt Input text prompt to guide content generation.

GenerateContentJSONRequestBody

GenerateContentJSONRequestBody defines body for GenerateContent for application/json ContentType.

Field name Field type Comment
type

GenerateContentJSONBody

No comment on field.

GenerateContentResponse

This type doesn't have documentation.

Field name Field type Comment
Body

[]byte

No comment on field.
HTTPResponse

*http.Response

No comment on field.
JSON200

*struct { // Content Generated content. Content *string `json:"content,omitempty"` }

No comment on field.

HttpRequestDoer

Doer performs HTTP requests.

The standard http.Client implements this interface.

Field name Field type Comment
type

any

No comment on field.

Models

This type doesn't have documentation.

Field name Field type Comment
Text

string

No comment on field.
MultiModal

string

No comment on field.

RequestEditorFn

RequestEditorFn is the function signature for the RequestEditor callback function

Field name Field type Comment
type

func(ctx context.Context, req *http.Request) error

No comment on field.

Functions

func NewClient

Creates a new Client, with reasonable defaults

Uses: http.Client, strings.HasSuffix.

func NewClientWithResponses

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func NewDeepseekClient

Uses: fmt.Errorf.

func NewGenerateContentRequest

NewGenerateContentRequest calls the generic GenerateContent builder with application/json body

Uses: bytes.NewReader, io.Reader, json.Marshal.

func NewGenerateContentRequestWithBody

NewGenerateContentRequestWithBody generates requests for GenerateContent with any type of body

Uses: fmt.Sprintf, http.NewRequest, url.Parse.

func ParseGenerateContentResponse

ParseGenerateContentResponse parses an HTTP response from a GenerateContentWithResponse call

Uses: io.ReadAll, json.Unmarshal, strings.Contains.

func WithBaseURL

WithBaseURL overrides the baseURL.

Uses: url.Parse.

func WithHTTPClient

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

func (*Client) GenerateContent

func (*Client) GenerateContentWithBody

func (*ClientWithResponses) GenerateContentWithBodyWithResponse

GenerateContentWithBodyWithResponse request with arbitrary body returning *GenerateContentResponse

func (*ClientWithResponses) GenerateContentWithResponse

func (Cfg) Validate

Uses: fmt.Errorf.

func (DeepseekClient) GenerateContent

Uses: classifier.Classification, fmt.Errorf, zap.Any.

func (GenerateContentResponse) Status

Status returns HTTPResponse.Status

Uses: http.StatusText.

func (GenerateContentResponse) StatusCode

StatusCode returns HTTPResponse.StatusCode

Private functions

func pickServerUrl

func promptToReq

References: fmt.Sprintf.

func respToClassification

References: classifier.Classification.

func applyEditors

func isLocal

References: strings.Contains.