Documentation
¶
Index ¶
- func CheckChat(t *testing.T, response *types.ChatCompletionResponse, modelName string, ...)
- func ErrorIs(t *testing.T, err, target error, msg ...string)
- func ErrorIsF(t *testing.T, err, target error, format string, msg ...string)
- func ErrorIsNot(t *testing.T, err, target error, msg ...string)
- func ErrorIsNotf(t *testing.T, err, target error, format string, msg ...string)
- func GetChannel(channelType int, baseUrl, other, porxy, modelMapping string) model.Channel
- func GetChatCompletionRequest(chatType, modelName, stream string) *types.ChatCompletionRequest
- func GetChatRequest(chatType, modelName, stream string) *strings.Reader
- func GetContext(method, path string, headers map[string]string, body io.Reader) (*gin.Context, *httptest.ResponseRecorder)
- func GetGinRouter(method, path string, headers map[string]string, body *io.Reader) *httptest.ResponseRecorder
- func GetTestToken() string
- func HasError(t *testing.T, err error, message ...string)
- func NoError(t *testing.T, err error, message ...string)
- func OpenAICheck(w http.ResponseWriter, r *http.Request) bool
- func RequestJSONConfig() map[string]string
- type ServerTest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetChannel ¶
func GetChatCompletionRequest ¶
func GetChatCompletionRequest(chatType, modelName, stream string) *types.ChatCompletionRequest
func GetChatRequest ¶
func GetContext ¶
func GetGinRouter ¶
func GetTestToken ¶
func GetTestToken() string
func OpenAICheck ¶
func OpenAICheck(w http.ResponseWriter, r *http.Request) bool
func RequestJSONConfig ¶
Types ¶
type ServerTest ¶
type ServerTest struct {
// contains filtered or unexported fields
}
func NewTestServer ¶
func NewTestServer() *ServerTest
func (*ServerTest) RegisterHandler ¶
func (ts *ServerTest) RegisterHandler(path string, handler handler)
func (*ServerTest) TestServer ¶
func (ts *ServerTest) TestServer(headerCheck func(w http.ResponseWriter, r *http.Request) bool) *httptest.Server
OpenAITestServer Creates a mocked OpenAI server which can pretend to handle requests during testing.
Click to show internal directories.
Click to hide internal directories.