openai

package
v0.0.0-...-74d9340 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertOpenAIRequestToGemini

func ConvertOpenAIRequestToGemini(openAIReq *EmbedRequest, model *genai.EmbeddingModel) (*genai.EmbeddingBatch, error)

Types

type EmbedRequest

type EmbedRequest struct {
	Input          interface{} `json:"input"`
	Model          string      `json:"model"`
	EncodingFormat string      `json:"encoding_format,omitempty"`
	Dimensions     int         `json:"dimensions,omitempty"`
	User           string      `json:"user,omitempty"`
}

type EmbedResponse

type EmbedResponse struct {
	Object string               `json:"object"`
	Data   []*EmbedResponseData `json:"data"`
	Model  string               `json:"model"`
	Usage  *Usage               `json:"usage"`
}

func ConvertGeminiResponseToOpenAI

func ConvertGeminiResponseToOpenAI(geminiBatchResp *genai.BatchEmbedContentsResponse, model string) *EmbedResponse

type EmbedResponseData

type EmbedResponseData struct {
	Object    string    `json:"object"`
	Embedding []float32 `json:"embedding"`
	Index     int       `json:"index"`
}

type ModelResponse

type ModelResponse struct {
	Object string               `json:"object"`
	Data   []*ModelResponseData `json:"data"`
}

type ModelResponseData

type ModelResponseData struct {
	Object  string `json:"object"`
	ID      string `json:"id"`
	Created uint   `json:"created"`
	OwnedBy string `json:"owned_by"`
}

type Usage

type Usage struct {
	PromptTokens int `json:"prompt_tokens"`
	TotalTokens  int `json:"total_tokens"`
}

Jump to

Keyboard shortcuts

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