Documentation
¶
Index ¶
- func CallWithRetry[T any](ctx context.Context, config Config, caller OpenaiCaller[T], payload string) (T, error)
- func ProcessRecordField[T any](ctx context.Context, rec opencdc.Record, resolver sdk.ReferenceResolver, ...) (opencdc.Record, error)
- func TestRecords() []opencdc.Record
- type Config
- type FlakyEmbeddingsCaller
- type FlakyOpenAICaller
- type MockEmbeddingsCaller
- type OpenaiCaller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallWithRetry ¶
func CallWithRetry[T any](ctx context.Context, config Config, caller OpenaiCaller[T], payload string) (T, error)
CallWithRetry handles retrying API calls with exponential backoff. This is meant to be used with openai api calls.
func ProcessRecordField ¶
func TestRecords ¶
Types ¶
type Config ¶
type Config struct { // MaxRetries is the maximum number of retries for API calls. Defaults to 3. MaxRetries int `json:"max_retries" default:"3"` // InitialBackoff is the initial backoff duration in milliseconds. Defaults to 1000ms (1s). InitialBackoff int `json:"initial_backoff" default:"1000"` // MaxBackoff is the maximum backoff duration in milliseconds. Defaults to 30000ms (30s). MaxBackoff int `json:"max_backoff" default:"30000"` // BackoffFactor is the factor by which the backoff increases. Defaults to 2.0 BackoffFactor float64 `json:"backoff_factor" default:"2.0"` }
Config contains common configuration options for OpenAI processors
type FlakyEmbeddingsCaller ¶
type FlakyOpenAICaller ¶
type FlakyOpenAICaller struct {
CallCount int
}
type MockEmbeddingsCaller ¶
type MockEmbeddingsCaller struct {
Embeddings []float32
}
Click to show internal directories.
Click to hide internal directories.