Documentation
¶
Overview ¶
Package mock provides a mock context for stream function.
Index ¶
- type MockContext
- func (c *MockContext) Data() []byte
- func (c *MockContext) HTTP() serverless.HTTP
- func (c *MockContext) LLMFunctionCall() (*ai.FunctionCall, error)
- func (c *MockContext) Metadata(_ string) (string, bool)
- func (c *MockContext) ReadLLMArguments(args any) error
- func (c *MockContext) RecordsWritten() []WriteRecord
- func (c *MockContext) Tag() uint32
- func (c *MockContext) Write(tag uint32, data []byte) error
- func (c *MockContext) WriteLLMResult(result string) error
- func (c *MockContext) WriteWithTarget(tag uint32, data []byte, target string) error
- type WriteRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockContext ¶
type MockContext struct {
// contains filtered or unexported fields
}
MockContext mock context.
func NewArgumentsContext ¶ added in v1.19.6
func NewArgumentsContext(arguments string, tag uint32) *MockContext
NewArgumentsContext creates a Context with the provided arguments and tag. This function is used for testing the LLM function.
func NewMockContext ¶
func NewMockContext(data []byte, tag uint32) *MockContext
NewMockContext returns the mock context. the data is that returned by ctx.Data(), the tag is that returned by ctx.Tag().
func (*MockContext) HTTP ¶
func (c *MockContext) HTTP() serverless.HTTP
HTTP returns the HTTP interface.H
func (*MockContext) LLMFunctionCall ¶ added in v1.18.10
func (c *MockContext) LLMFunctionCall() (*ai.FunctionCall, error)
LLMFunctionCall reads LLM function call
func (*MockContext) Metadata ¶ added in v1.18.5
func (c *MockContext) Metadata(_ string) (string, bool)
Metadata returns the metadata by the given key.
func (*MockContext) ReadLLMArguments ¶ added in v1.18.10
func (c *MockContext) ReadLLMArguments(args any) error
ReadLLMArguments reads LLM function arguments.
func (*MockContext) RecordsWritten ¶ added in v1.17.4
func (c *MockContext) RecordsWritten() []WriteRecord
RecordsWritten returns the data records be written with `ctx.Write`.
func (*MockContext) Write ¶
func (c *MockContext) Write(tag uint32, data []byte) error
Write writes the data with the given tag.
func (*MockContext) WriteLLMResult ¶ added in v1.18.10
func (c *MockContext) WriteLLMResult(result string) error
WriteLLMResult writes LLM function result.
func (*MockContext) WriteWithTarget ¶ added in v1.17.4
func (c *MockContext) WriteWithTarget(tag uint32, data []byte, target string) error
WriteWithTarget writes the data with the given tag and target.