Documentation
¶
Index ¶
- type Client
- type ClientOption
- type Dimensions
- type DocumentUrlResponse
- type EmbeddingData
- type EmbeddingRequest
- type EmbeddingResponse
- type EmbeddingService
- type EmbeddingUsage
- type Error
- type FileType
- type FileUploadRequest
- type FileUploadResponse
- type FilesService
- type GetFilesRequest
- type GetFilesResponse
- type OCRImage
- type OCRPage
- type OCRRequest
- type OCRRequestModel
- type OCRResponse
- type OCRService
- type OCRUsage
- type SampleType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // User agent used when communicating with Mistral AI API. UserAgent string // Services used for communicating with different parts of the Mistral AI API. OCR *OCRService Files *FilesService Embedding *EmbeddingService // contains filtered or unexported fields }
Client manages communication with Mistral AI API.
func NewClient ¶
func NewClient(apiKey string, opts ...ClientOption) (*Client, error)
NewClient creates a new Mistral AI API client.
func (*Client) AuthHeader ¶ added in v0.0.2
type ClientOption ¶
ClientOption is a function that modifies the client.
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
WithBaseURL sets a custom base URL for the client.
type Dimensions ¶ added in v0.0.2
type DocumentUrlResponse ¶ added in v0.0.2
type DocumentUrlResponse struct {
Url string `json:"url"`
}
type EmbeddingData ¶
type EmbeddingRequest ¶
type EmbeddingResponse ¶
type EmbeddingResponse struct { Id string `json:"id"` Object string `json:"object"` Model string `json:"model"` Data []EmbeddingData `json:"data"` Usage EmbeddingUsage `json:"usage"` }
type EmbeddingService ¶ added in v0.0.2
type EmbeddingService struct {
// contains filtered or unexported fields
}
func (*EmbeddingService) Create ¶ added in v0.0.2
func (s *EmbeddingService) Create(request *EmbeddingRequest) (*EmbeddingResponse, error)
type EmbeddingUsage ¶ added in v0.0.2
type FileUploadRequest ¶ added in v0.0.2
type FileUploadResponse ¶ added in v0.0.2
type FileUploadResponse struct { ID string `json:"id"` Object string `json:"object"` Bytes int `json:"bytes"` CreatedAt int64 `json:"created_at"` Filename string `json:"filename"` Purpose string `json:"purpose"` SampleType string `json:"sample_type"` NumLines *int `json:"num_lines,omitempty"` Source string `json:"source"` }
type FilesService ¶
type FilesService struct {
// contains filtered or unexported fields
}
func (*FilesService) GetDocumentUrl ¶ added in v0.0.2
func (s *FilesService) GetDocumentUrl(id string, expiry int) (*DocumentUrlResponse, error)
func (*FilesService) GetFiles ¶ added in v0.0.2
func (s *FilesService) GetFiles(getFilesRequest *GetFilesRequest) (*GetFilesResponse, error)
func (*FilesService) Upload ¶
func (s *FilesService) Upload(fileUploadRequest *FileUploadRequest) (*FileUploadResponse, error)
type GetFilesRequest ¶ added in v0.0.2
type GetFilesResponse ¶ added in v0.0.2
type OCRPage ¶ added in v0.0.2
type OCRPage struct { Index int `json:"index"` Markdown string `json:"markdown"` Images []OCRImage `json:"images"` Dimensions Dimensions `json:"dimensions"` }
type OCRRequest ¶
type OCRRequest struct { Model string `json:"model"` ID string `json:"id"` Document OCRRequestModel `json:"document"` Pages []int `json:"pages"` IncludeImageBase64 bool `json:"include_image_base64"` ImageLimit int `json:"image_limit"` ImageMinSize int `json:"image_min_size"` }
OCRRequest represents a request to perform OCR on an image.
type OCRRequestModel ¶ added in v0.0.2
type OCRRequestModel struct { Type string `json:"type" enum:"document_url"` DocumentURL string `json:"document_url,omitempty" binding:"required_if=Type document_url"` ImageURL string `json:"image_url,omitempty" binding:"required_if=Type image_url"` DocumentName string `json:"document_name,omitempty"` }
type OCRResponse ¶
type OCRService ¶
type OCRService struct {
// contains filtered or unexported fields
}
OCRService handles communication with the OCR related methods of the Mistral AI API.
func (*OCRService) Process ¶ added in v0.0.2
func (s *OCRService) Process(request *OCRRequest) (*OCRResponse, error)
Process submits an OCR request
type SampleType ¶ added in v0.0.2
type SampleType string
const ( SampleTypePretrain SampleType = "pretrain" SampleTypeInstruct SampleType = "instruct" SampleTypeBatchRequest SampleType = "batch_request" SampleTypeBatchResult SampleType = "batch_result" SampleTypeBatchError SampleType = "batch_error" SampleTypeOCRInput SampleType = "ocr_input" )
Click to show internal directories.
Click to hide internal directories.