Documentation
¶
Index ¶
- func ClearTestingPath(cwd string)
- func GetRuntime(pluginZip []byte, cwd string) (*local_runtime.LocalPluginRuntime, error)
- func RunOnce[T RunOnceRequest, R any](runtime *local_runtime.LocalPluginRuntime, ...) (*stream.Stream[R], error)
- func RunOnceWithSession[T RunOnceRequest, R any](runtime *local_runtime.LocalPluginRuntime, session *session_manager.Session, ...) (*stream.Stream[R], error)
- func StartFakeOpenAIServer() (int, func())
- type Delta
- type FakeOpenAIResponse
- type RunOnceRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearTestingPath ¶
func ClearTestingPath(cwd string)
func GetRuntime ¶
func GetRuntime(pluginZip []byte, cwd string) (*local_runtime.LocalPluginRuntime, error)
GetRuntime returns a runtime for a plugin Please ensure cwd is a valid directory without any file in it
func RunOnce ¶
func RunOnce[T RunOnceRequest, R any]( runtime *local_runtime.LocalPluginRuntime, accessType access_types.PluginAccessType, action access_types.PluginAccessAction, request T, ) (*stream.Stream[R], error)
RunOnce sends a request to plugin and returns a stream of responses It automatically generates a session for the request
func RunOnceWithSession ¶
func RunOnceWithSession[T RunOnceRequest, R any]( runtime *local_runtime.LocalPluginRuntime, session *session_manager.Session, request T, ) (*stream.Stream[R], error)
RunOnceWithSession sends a request to plugin and returns a stream of responses It requires a session to be provided
func StartFakeOpenAIServer ¶
func StartFakeOpenAIServer() (int, func())
StartFakeOpenAIServer starts a fake OpenAI server that streams responses Returns the port number and a cancel function to stop the server
Types ¶
type FakeOpenAIResponse ¶
type FakeOpenAIResponse struct { ID string `json:"id"` Object string `json:"object"` Created int64 `json:"created"` Model string `json:"model"` Choices []struct { Index int `json:"index"` Delta Delta `json:"delta"` FinishReason *string `json:"finish_reason"` } `json:"choices"` }
FakeOpenAIResponse represents the structure of an OpenAI chat completion response
type RunOnceRequest ¶
type RunOnceRequest interface { requests.RequestInvokeLLM | requests.RequestInvokeTextEmbedding | requests.RequestInvokeRerank | requests.RequestInvokeTTS | requests.RequestInvokeSpeech2Text | requests.RequestInvokeModeration | requests.RequestValidateProviderCredentials | requests.RequestValidateModelCredentials | requests.RequestGetTTSModelVoices | requests.RequestGetTextEmbeddingNumTokens | requests.RequestGetLLMNumTokens | requests.RequestGetAIModelSchema | requests.RequestInvokeAgentStrategy | requests.RequestOAuthGetAuthorizationURL | requests.RequestOAuthGetCredentials | requests.RequestInvokeEndpoint | map[string]any }
Click to show internal directories.
Click to hide internal directories.