Documentation
¶
Overview ¶
Package providers implements various LLM providers and their utility functions. This file contains the Perplexity provider implementation.
Index ¶
- type MediaResponse
- type MediaResponseOverrides
- type PerplexityChatRequest
- type PerplexityChatResponse
- type PerplexityProvider
- func (provider *PerplexityProvider) BatchCancel(_ *schemas.BifrostContext, _ []schemas.Key, ...) (*schemas.BifrostBatchCancelResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) BatchCreate(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostBatchCreateRequest) (*schemas.BifrostBatchCreateResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) BatchDelete(_ *schemas.BifrostContext, _ []schemas.Key, ...) (*schemas.BifrostBatchDeleteResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) BatchList(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostBatchListRequest) (*schemas.BifrostBatchListResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) BatchResults(_ *schemas.BifrostContext, _ []schemas.Key, ...) (*schemas.BifrostBatchResultsResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) BatchRetrieve(_ *schemas.BifrostContext, _ []schemas.Key, ...) (*schemas.BifrostBatchRetrieveResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) ChatCompletion(ctx *schemas.BifrostContext, key schemas.Key, ...) (*schemas.BifrostChatResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) ChatCompletionStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, ...) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
- func (provider *PerplexityProvider) ContainerCreate(_ *schemas.BifrostContext, _ schemas.Key, ...) (*schemas.BifrostContainerCreateResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) ContainerDelete(_ *schemas.BifrostContext, _ []schemas.Key, ...) (*schemas.BifrostContainerDeleteResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) ContainerFileContent(_ *schemas.BifrostContext, _ []schemas.Key, ...) (*schemas.BifrostContainerFileContentResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) ContainerFileCreate(_ *schemas.BifrostContext, _ schemas.Key, ...) (*schemas.BifrostContainerFileCreateResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) ContainerFileDelete(_ *schemas.BifrostContext, _ []schemas.Key, ...) (*schemas.BifrostContainerFileDeleteResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) ContainerFileList(_ *schemas.BifrostContext, _ []schemas.Key, ...) (*schemas.BifrostContainerFileListResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) ContainerFileRetrieve(_ *schemas.BifrostContext, _ []schemas.Key, ...) (*schemas.BifrostContainerFileRetrieveResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) ContainerList(_ *schemas.BifrostContext, _ []schemas.Key, ...) (*schemas.BifrostContainerListResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) ContainerRetrieve(_ *schemas.BifrostContext, _ []schemas.Key, ...) (*schemas.BifrostContainerRetrieveResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) CountTokens(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostResponsesRequest) (*schemas.BifrostCountTokensResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) Embedding(ctx *schemas.BifrostContext, key schemas.Key, ...) (*schemas.BifrostEmbeddingResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) FileContent(_ *schemas.BifrostContext, _ []schemas.Key, ...) (*schemas.BifrostFileContentResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) FileDelete(_ *schemas.BifrostContext, _ []schemas.Key, ...) (*schemas.BifrostFileDeleteResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) FileList(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostFileListRequest) (*schemas.BifrostFileListResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) FileRetrieve(_ *schemas.BifrostContext, _ []schemas.Key, ...) (*schemas.BifrostFileRetrieveResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) FileUpload(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostFileUploadRequest) (*schemas.BifrostFileUploadResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) GetProviderKey() schemas.ModelProvider
- func (provider *PerplexityProvider) ImageEdit(ctx *schemas.BifrostContext, key schemas.Key, ...) (*schemas.BifrostImageGenerationResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) ImageEditStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, ...) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
- func (provider *PerplexityProvider) ImageGeneration(ctx *schemas.BifrostContext, key schemas.Key, ...) (*schemas.BifrostImageGenerationResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) ImageGenerationStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, ...) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
- func (provider *PerplexityProvider) ImageVariation(ctx *schemas.BifrostContext, key schemas.Key, ...) (*schemas.BifrostImageGenerationResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) ListModels(ctx *schemas.BifrostContext, keys []schemas.Key, ...) (*schemas.BifrostListModelsResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) OCR(ctx *schemas.BifrostContext, key schemas.Key, ...) (*schemas.BifrostOCRResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) Passthrough(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostPassthroughRequest) (*schemas.BifrostPassthroughResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) PassthroughStream(_ *schemas.BifrostContext, _ schemas.PostHookRunner, _ func(context.Context), ...) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
- func (provider *PerplexityProvider) Rerank(ctx *schemas.BifrostContext, key schemas.Key, ...) (*schemas.BifrostRerankResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) Responses(ctx *schemas.BifrostContext, key schemas.Key, ...) (*schemas.BifrostResponsesResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) ResponsesStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, ...) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
- func (provider *PerplexityProvider) Speech(ctx *schemas.BifrostContext, key schemas.Key, ...) (*schemas.BifrostSpeechResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) SpeechStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, ...) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
- func (provider *PerplexityProvider) TextCompletion(ctx *schemas.BifrostContext, key schemas.Key, ...) (*schemas.BifrostTextCompletionResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) TextCompletionStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, ...) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
- func (provider *PerplexityProvider) Transcription(ctx *schemas.BifrostContext, key schemas.Key, ...) (*schemas.BifrostTranscriptionResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) TranscriptionStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, ...) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
- func (provider *PerplexityProvider) VideoDelete(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostVideoDeleteRequest) (*schemas.BifrostVideoDeleteResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) VideoDownload(_ *schemas.BifrostContext, _ schemas.Key, ...) (*schemas.BifrostVideoDownloadResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) VideoGeneration(_ *schemas.BifrostContext, _ schemas.Key, ...) (*schemas.BifrostVideoGenerationResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) VideoList(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostVideoListRequest) (*schemas.BifrostVideoListResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) VideoRemix(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostVideoRemixRequest) (*schemas.BifrostVideoGenerationResponse, *schemas.BifrostError)
- func (provider *PerplexityProvider) VideoRetrieve(_ *schemas.BifrostContext, _ schemas.Key, ...) (*schemas.BifrostVideoGenerationResponse, *schemas.BifrostError)
- type Usage
- type WebSearchOption
- type WebSearchOptionUserLocation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MediaResponse ¶
type MediaResponse struct {
Overrides MediaResponseOverrides `json:"overrides,omitempty"` // Optional: Overrides for the media response
}
type MediaResponseOverrides ¶
type PerplexityChatRequest ¶
type PerplexityChatRequest struct {
Model string `json:"model"` // Required: Model to use for chat completion
Messages []schemas.ChatMessage `json:"messages"` // Required: Array of message objects
SearchMode *string `json:"search_mode"` // Required: Search mode
ReasoningEffort *string `json:"reasoning_effort"` // Required: Reasoning effort (low, medium, high)
MaxTokens *int `json:"max_tokens,omitempty"` // Optional: Maximum tokens to generate
Temperature *float64 `json:"temperature,omitempty"` // Optional: Sampling temperature
TopP *float64 `json:"top_p,omitempty"` // Optional: Top-p sampling
LanguagePreference *string `json:"language_preference,omitempty"` // Optional: Language preference
SearchDomainFilter []string `json:"search_domain_filter,omitempty"` // Optional: Search domain filter
ReturnImages *bool `json:"return_images,omitempty"` // Optional: Return images
ReturnRelatedQuestions *bool `json:"return_related_questions,omitempty"` // Optional: Return related questions
SearchRecencyFilter *string `json:"search_recency_filter,omitempty"` // Optional: Search recency filter
SearchAfterDateFilter *string `json:"search_after_date_filter,omitempty"` // Optional: Search after date filter
SearchBeforeDateFilter *string `json:"search_before_date_filter,omitempty"` // Optional: Search before date filter
LastUpdatedAfterFilter *string `json:"last_updated_after_filter,omitempty"` // Optional: Last updated after filter
LastUpdatedBeforeFilter *string `json:"last_updated_before_filter,omitempty"` // Optional: Last updated before filter
TopK *int `json:"top_k,omitempty"` // Optional: Top-k sampling
Stream *bool `json:"stream,omitempty"` // Optional: Enable streaming
PresencePenalty *float64 `json:"presence_penalty,omitempty"` // Optional: Presence penalty
FrequencyPenalty *float64 `json:"frequency_penalty,omitempty"` // Optional: Frequency penalty
ResponseFormat *interface{} `json:"response_format,omitempty"` // Format for the response
DisableSearch *bool `json:"disable_search,omitempty"` // Optional: Disable search
EnableSearchClassifier *bool `json:"enable_search_classifier,omitempty"` // Optional: Enable search classifier
WebSearchOptions []WebSearchOption `json:"web_search_options,omitempty"` // Optional: Web search options
MediaResponse *MediaResponse `json:"media_response,omitempty"` // Optional: Media response
Tools []schemas.ChatTool `json:"tools,omitempty"` // Optional: Tools available for the model
ToolChoice *schemas.ChatToolChoice `json:"tool_choice,omitempty"` // Optional: Whether to call a tool
ParallelToolCalls *bool `json:"parallel_tool_calls,omitempty"` // Optional: Enable parallel tool calls
Stop []string `json:"stop,omitempty"` // Optional: Stop sequences
LogProbs *bool `json:"logprobs,omitempty"` // Optional: Return log probabilities
TopLogProbs *int `json:"top_logprobs,omitempty"` // Optional: Number of top log probabilities
NumSearchResults *int `json:"num_search_results,omitempty"` // Optional: Number of search results
NumImages *int `json:"num_images,omitempty"` // Optional: Number of images
SearchLanguageFilter []string `json:"search_language_filter,omitempty"` // Optional: Search language filter
ImageFormatFilter []string `json:"image_format_filter,omitempty"` // Optional: Image format filter
ImageDomainFilter []string `json:"image_domain_filter,omitempty"` // Optional: Image domain filter
SafeSearch *bool `json:"safe_search,omitempty"` // Optional: Enable safe search
StreamMode *string `json:"stream_mode,omitempty"` // Optional: Stream mode
ExtraParams map[string]interface{} `json:"-"`
}
PerplexityChatRequest represents a Perplexity chat completion request
func ToPerplexityChatCompletionRequest ¶
func ToPerplexityChatCompletionRequest(bifrostReq *schemas.BifrostChatRequest) *PerplexityChatRequest
ToPerplexityChatCompletionRequest converts a Bifrost request to Perplexity chat completion request
func ToPerplexityResponsesRequest ¶
func ToPerplexityResponsesRequest(bifrostReq *schemas.BifrostResponsesRequest) *PerplexityChatRequest
ToPerplexityResponsesRequest converts a BifrostResponsesRequest to PerplexityChatRequest
func (*PerplexityChatRequest) GetExtraParams ¶
func (r *PerplexityChatRequest) GetExtraParams() map[string]interface{}
GetExtraParams implements the RequestBodyWithExtraParams interface
type PerplexityChatResponse ¶
type PerplexityChatResponse struct {
ID string `json:"id"`
Choices []schemas.BifrostResponseChoice `json:"choices"`
Created int `json:"created"` // The Unix timestamp (in seconds).
Model string `json:"model"`
Object string `json:"object"` // "chat.completion" or "chat.completion.chunk"
Citations []string `json:"citations,omitempty"`
SearchResults []schemas.SearchResult `json:"search_results,omitempty"`
Videos []schemas.VideoResult `json:"videos,omitempty"`
Usage *Usage `json:"usage,omitempty"`
}
func (*PerplexityChatResponse) ToBifrostChatResponse ¶
func (response *PerplexityChatResponse) ToBifrostChatResponse(model string) *schemas.BifrostChatResponse
ToBifrostChatResponse converts a Perplexity chat completion response to Bifrost format
type PerplexityProvider ¶
type PerplexityProvider struct {
// contains filtered or unexported fields
}
PerplexityProvider implements the Provider interface for Perplexity's API.
func NewPerplexityProvider ¶
func NewPerplexityProvider(config *schemas.ProviderConfig, logger schemas.Logger) (*PerplexityProvider, error)
NewPerplexityProvider creates a new Perplexity provider instance. It initializes the HTTP client with the provided configuration and sets up response pools. The client is configured with timeouts, concurrency limits, and optional proxy settings.
func (*PerplexityProvider) BatchCancel ¶
func (provider *PerplexityProvider) BatchCancel(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostBatchCancelRequest) (*schemas.BifrostBatchCancelResponse, *schemas.BifrostError)
BatchCancel is not supported by Perplexity provider.
func (*PerplexityProvider) BatchCreate ¶
func (provider *PerplexityProvider) BatchCreate(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostBatchCreateRequest) (*schemas.BifrostBatchCreateResponse, *schemas.BifrostError)
BatchCreate is not supported by Perplexity provider.
func (*PerplexityProvider) BatchDelete ¶
func (provider *PerplexityProvider) BatchDelete(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostBatchDeleteRequest) (*schemas.BifrostBatchDeleteResponse, *schemas.BifrostError)
BatchDelete is not supported by Perplexity provider.
func (*PerplexityProvider) BatchList ¶
func (provider *PerplexityProvider) BatchList(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostBatchListRequest) (*schemas.BifrostBatchListResponse, *schemas.BifrostError)
BatchList is not supported by Perplexity provider.
func (*PerplexityProvider) BatchResults ¶
func (provider *PerplexityProvider) BatchResults(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostBatchResultsRequest) (*schemas.BifrostBatchResultsResponse, *schemas.BifrostError)
BatchResults is not supported by Perplexity provider.
func (*PerplexityProvider) BatchRetrieve ¶
func (provider *PerplexityProvider) BatchRetrieve(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostBatchRetrieveRequest) (*schemas.BifrostBatchRetrieveResponse, *schemas.BifrostError)
BatchRetrieve is not supported by Perplexity provider.
func (*PerplexityProvider) ChatCompletion ¶
func (provider *PerplexityProvider) ChatCompletion(ctx *schemas.BifrostContext, key schemas.Key, request *schemas.BifrostChatRequest) (*schemas.BifrostChatResponse, *schemas.BifrostError)
ChatCompletion performs a chat completion request to the Perplexity API.
func (*PerplexityProvider) ChatCompletionStream ¶
func (provider *PerplexityProvider) ChatCompletionStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, postHookSpanFinalizer func(context.Context), key schemas.Key, request *schemas.BifrostChatRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
ChatCompletionStream performs a streaming chat completion request to the Perplexity API. It supports real-time streaming of responses using Server-Sent Events (SSE). Uses Perplexity's OpenAI-compatible streaming format. Returns a channel containing BifrostStreamChunk objects representing the stream or an error if the request fails.
func (*PerplexityProvider) ContainerCreate ¶
func (provider *PerplexityProvider) ContainerCreate(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostContainerCreateRequest) (*schemas.BifrostContainerCreateResponse, *schemas.BifrostError)
ContainerCreate is not supported by the Perplexity provider.
func (*PerplexityProvider) ContainerDelete ¶
func (provider *PerplexityProvider) ContainerDelete(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostContainerDeleteRequest) (*schemas.BifrostContainerDeleteResponse, *schemas.BifrostError)
ContainerDelete is not supported by the Perplexity provider.
func (*PerplexityProvider) ContainerFileContent ¶
func (provider *PerplexityProvider) ContainerFileContent(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostContainerFileContentRequest) (*schemas.BifrostContainerFileContentResponse, *schemas.BifrostError)
ContainerFileContent is not supported by the Perplexity provider.
func (*PerplexityProvider) ContainerFileCreate ¶
func (provider *PerplexityProvider) ContainerFileCreate(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostContainerFileCreateRequest) (*schemas.BifrostContainerFileCreateResponse, *schemas.BifrostError)
ContainerFileCreate is not supported by the Perplexity provider.
func (*PerplexityProvider) ContainerFileDelete ¶
func (provider *PerplexityProvider) ContainerFileDelete(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostContainerFileDeleteRequest) (*schemas.BifrostContainerFileDeleteResponse, *schemas.BifrostError)
ContainerFileDelete is not supported by the Perplexity provider.
func (*PerplexityProvider) ContainerFileList ¶
func (provider *PerplexityProvider) ContainerFileList(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostContainerFileListRequest) (*schemas.BifrostContainerFileListResponse, *schemas.BifrostError)
ContainerFileList is not supported by the Perplexity provider.
func (*PerplexityProvider) ContainerFileRetrieve ¶
func (provider *PerplexityProvider) ContainerFileRetrieve(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostContainerFileRetrieveRequest) (*schemas.BifrostContainerFileRetrieveResponse, *schemas.BifrostError)
ContainerFileRetrieve is not supported by the Perplexity provider.
func (*PerplexityProvider) ContainerList ¶
func (provider *PerplexityProvider) ContainerList(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostContainerListRequest) (*schemas.BifrostContainerListResponse, *schemas.BifrostError)
ContainerList is not supported by the Perplexity provider.
func (*PerplexityProvider) ContainerRetrieve ¶
func (provider *PerplexityProvider) ContainerRetrieve(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostContainerRetrieveRequest) (*schemas.BifrostContainerRetrieveResponse, *schemas.BifrostError)
ContainerRetrieve is not supported by the Perplexity provider.
func (*PerplexityProvider) CountTokens ¶
func (provider *PerplexityProvider) CountTokens(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostResponsesRequest) (*schemas.BifrostCountTokensResponse, *schemas.BifrostError)
CountTokens is not supported by the Perplexity provider.
func (*PerplexityProvider) Embedding ¶
func (provider *PerplexityProvider) Embedding(ctx *schemas.BifrostContext, key schemas.Key, request *schemas.BifrostEmbeddingRequest) (*schemas.BifrostEmbeddingResponse, *schemas.BifrostError)
Embedding is not supported by the Perplexity provider.
func (*PerplexityProvider) FileContent ¶
func (provider *PerplexityProvider) FileContent(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostFileContentRequest) (*schemas.BifrostFileContentResponse, *schemas.BifrostError)
FileContent is not supported by Perplexity provider.
func (*PerplexityProvider) FileDelete ¶
func (provider *PerplexityProvider) FileDelete(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostFileDeleteRequest) (*schemas.BifrostFileDeleteResponse, *schemas.BifrostError)
FileDelete is not supported by Perplexity provider.
func (*PerplexityProvider) FileList ¶
func (provider *PerplexityProvider) FileList(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostFileListRequest) (*schemas.BifrostFileListResponse, *schemas.BifrostError)
FileList is not supported by Perplexity provider.
func (*PerplexityProvider) FileRetrieve ¶
func (provider *PerplexityProvider) FileRetrieve(_ *schemas.BifrostContext, _ []schemas.Key, _ *schemas.BifrostFileRetrieveRequest) (*schemas.BifrostFileRetrieveResponse, *schemas.BifrostError)
FileRetrieve is not supported by Perplexity provider.
func (*PerplexityProvider) FileUpload ¶
func (provider *PerplexityProvider) FileUpload(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostFileUploadRequest) (*schemas.BifrostFileUploadResponse, *schemas.BifrostError)
FileUpload is not supported by Perplexity provider.
func (*PerplexityProvider) GetProviderKey ¶
func (provider *PerplexityProvider) GetProviderKey() schemas.ModelProvider
GetProviderKey returns the provider identifier for Perplexity.
func (*PerplexityProvider) ImageEdit ¶
func (provider *PerplexityProvider) ImageEdit(ctx *schemas.BifrostContext, key schemas.Key, request *schemas.BifrostImageEditRequest) (*schemas.BifrostImageGenerationResponse, *schemas.BifrostError)
ImageEdit is not supported by the Perplexity provider.
func (*PerplexityProvider) ImageEditStream ¶
func (provider *PerplexityProvider) ImageEditStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, postHookSpanFinalizer func(context.Context), key schemas.Key, request *schemas.BifrostImageEditRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
ImageEditStream is not supported by the Perplexity provider.
func (*PerplexityProvider) ImageGeneration ¶
func (provider *PerplexityProvider) ImageGeneration(ctx *schemas.BifrostContext, key schemas.Key, request *schemas.BifrostImageGenerationRequest) (*schemas.BifrostImageGenerationResponse, *schemas.BifrostError)
ImageGeneration is not supported by the Perplexity provider.
func (*PerplexityProvider) ImageGenerationStream ¶
func (provider *PerplexityProvider) ImageGenerationStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, postHookSpanFinalizer func(context.Context), key schemas.Key, request *schemas.BifrostImageGenerationRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
ImageGenerationStream is not supported by the Perplexity provider.
func (*PerplexityProvider) ImageVariation ¶
func (provider *PerplexityProvider) ImageVariation(ctx *schemas.BifrostContext, key schemas.Key, request *schemas.BifrostImageVariationRequest) (*schemas.BifrostImageGenerationResponse, *schemas.BifrostError)
ImageVariation is not supported by the Perplexity provider.
func (*PerplexityProvider) ListModels ¶
func (provider *PerplexityProvider) ListModels(ctx *schemas.BifrostContext, keys []schemas.Key, request *schemas.BifrostListModelsRequest) (*schemas.BifrostListModelsResponse, *schemas.BifrostError)
ListModels performs a list models request to Perplexity's API.
func (*PerplexityProvider) OCR ¶ added in v1.4.20
func (provider *PerplexityProvider) OCR(ctx *schemas.BifrostContext, key schemas.Key, request *schemas.BifrostOCRRequest) (*schemas.BifrostOCRResponse, *schemas.BifrostError)
OCR is not supported by the Perplexity provider.
func (*PerplexityProvider) Passthrough ¶
func (provider *PerplexityProvider) Passthrough(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostPassthroughRequest) (*schemas.BifrostPassthroughResponse, *schemas.BifrostError)
Passthrough is not supported by the Perplexity provider.
func (*PerplexityProvider) PassthroughStream ¶
func (provider *PerplexityProvider) PassthroughStream(_ *schemas.BifrostContext, _ schemas.PostHookRunner, _ func(context.Context), _ schemas.Key, _ *schemas.BifrostPassthroughRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
func (*PerplexityProvider) Rerank ¶
func (provider *PerplexityProvider) Rerank(ctx *schemas.BifrostContext, key schemas.Key, request *schemas.BifrostRerankRequest) (*schemas.BifrostRerankResponse, *schemas.BifrostError)
Rerank is not supported by the Perplexity provider.
func (*PerplexityProvider) Responses ¶
func (provider *PerplexityProvider) Responses(ctx *schemas.BifrostContext, key schemas.Key, request *schemas.BifrostResponsesRequest) (*schemas.BifrostResponsesResponse, *schemas.BifrostError)
Responses performs a responses request to the Perplexity API.
func (*PerplexityProvider) ResponsesStream ¶
func (provider *PerplexityProvider) ResponsesStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, postHookSpanFinalizer func(context.Context), key schemas.Key, request *schemas.BifrostResponsesRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
ResponsesStream performs a streaming responses request to the Perplexity API.
func (*PerplexityProvider) Speech ¶
func (provider *PerplexityProvider) Speech(ctx *schemas.BifrostContext, key schemas.Key, request *schemas.BifrostSpeechRequest) (*schemas.BifrostSpeechResponse, *schemas.BifrostError)
Speech is not supported by the Perplexity provider.
func (*PerplexityProvider) SpeechStream ¶
func (provider *PerplexityProvider) SpeechStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, postHookSpanFinalizer func(context.Context), key schemas.Key, request *schemas.BifrostSpeechRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
SpeechStream is not supported by the Perplexity provider.
func (*PerplexityProvider) TextCompletion ¶
func (provider *PerplexityProvider) TextCompletion(ctx *schemas.BifrostContext, key schemas.Key, request *schemas.BifrostTextCompletionRequest) (*schemas.BifrostTextCompletionResponse, *schemas.BifrostError)
TextCompletion is not supported by the Perplexity provider.
func (*PerplexityProvider) TextCompletionStream ¶
func (provider *PerplexityProvider) TextCompletionStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, postHookSpanFinalizer func(context.Context), key schemas.Key, request *schemas.BifrostTextCompletionRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
TextCompletionStream performs a streaming text completion request to Perplexity's API. It formats the request, sends it to Perplexity, and processes the response. Returns a channel of BifrostStreamChunk objects or an error if the request fails.
func (*PerplexityProvider) Transcription ¶
func (provider *PerplexityProvider) Transcription(ctx *schemas.BifrostContext, key schemas.Key, request *schemas.BifrostTranscriptionRequest) (*schemas.BifrostTranscriptionResponse, *schemas.BifrostError)
Transcription is not supported by the Perplexity provider.
func (*PerplexityProvider) TranscriptionStream ¶
func (provider *PerplexityProvider) TranscriptionStream(ctx *schemas.BifrostContext, postHookRunner schemas.PostHookRunner, postHookSpanFinalizer func(context.Context), key schemas.Key, request *schemas.BifrostTranscriptionRequest) (chan *schemas.BifrostStreamChunk, *schemas.BifrostError)
TranscriptionStream is not supported by the Perplexity provider.
func (*PerplexityProvider) VideoDelete ¶
func (provider *PerplexityProvider) VideoDelete(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostVideoDeleteRequest) (*schemas.BifrostVideoDeleteResponse, *schemas.BifrostError)
VideoDelete is not supported by Perplexity provider.
func (*PerplexityProvider) VideoDownload ¶
func (provider *PerplexityProvider) VideoDownload(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostVideoDownloadRequest) (*schemas.BifrostVideoDownloadResponse, *schemas.BifrostError)
VideoDownload is not supported by the Perplexity provider.
func (*PerplexityProvider) VideoGeneration ¶
func (provider *PerplexityProvider) VideoGeneration(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostVideoGenerationRequest) (*schemas.BifrostVideoGenerationResponse, *schemas.BifrostError)
VideoGeneration is not supported by the Perplexity provider.
func (*PerplexityProvider) VideoList ¶
func (provider *PerplexityProvider) VideoList(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostVideoListRequest) (*schemas.BifrostVideoListResponse, *schemas.BifrostError)
VideoList is not supported by Perplexity provider.
func (*PerplexityProvider) VideoRemix ¶
func (provider *PerplexityProvider) VideoRemix(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostVideoRemixRequest) (*schemas.BifrostVideoGenerationResponse, *schemas.BifrostError)
VideoRemix is not supported by Perplexity provider.
func (*PerplexityProvider) VideoRetrieve ¶
func (provider *PerplexityProvider) VideoRetrieve(_ *schemas.BifrostContext, _ schemas.Key, _ *schemas.BifrostVideoRetrieveRequest) (*schemas.BifrostVideoGenerationResponse, *schemas.BifrostError)
VideoRetrieve is not supported by the Perplexity provider.
type Usage ¶
type Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
SearchContextSize *string `json:"search_context_size,omitempty"`
CitationTokens *int `json:"citation_tokens,omitempty"`
NumSearchQueries *int `json:"num_search_queries,omitempty"`
ReasoningTokens *int `json:"reasoning_tokens,omitempty"`
Cost *schemas.BifrostCost `json:"cost,omitempty"`
}
type WebSearchOption ¶
type WebSearchOption struct {
SearchContextSize *string `json:"search_context_size,omitempty"` // "low" | "medium" | "high"
UserLocation *WebSearchOptionUserLocation `json:"user_location,omitempty"` // The approximate location of the user
ImageResultsEnhancedRelevance *bool `json:"image_results_enhanced_relevance,omitempty"` // Optional: Image results enhanced relevance
SearchType *string `json:"search_type,omitempty"` // Optional: "general" | "news" | "academic" | "social" | "writing"
}
type WebSearchOptionUserLocation ¶
type WebSearchOptionUserLocation struct {
Latitude *float64 `json:"latitude,omitempty"`
Longitude *float64 `json:"longitude,omitempty"`
City *string `json:"city,omitempty"` // Free text input for the city
Country *string `json:"country,omitempty"` // Two-letter ISO country code
Region *string `json:"region,omitempty"` // Free text input for the region
}