From dcb2cabc7ce48f1b4bd1107efcc524508d9add6d Mon Sep 17 00:00:00 2001 From: Achim Rohn Date: Mon, 8 Dec 2025 23:41:47 +0100 Subject: [PATCH] Add mocked content field --- llm/mistral.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/llm/mistral.go b/llm/mistral.go index be0a390..737f83e 100644 --- a/llm/mistral.go +++ b/llm/mistral.go @@ -4,9 +4,10 @@ import ( "bytes" "encoding/json" "fmt" - "git.gorlug.de/code/ersteller" "io" "net/http" + + "git.gorlug.de/code/ersteller" ) type ChatCompletionRequestResponseFormatType string @@ -148,15 +149,20 @@ type MistralClient interface { CreateChatCompletion(req *ChatCompletionRequest) (*ChatCompletionResponse, error) } -type MistralClientMock struct{} +type MistralClientMock struct { + MockedContent string +} func (m MistralClientMock) CreateChatCompletion(req *ChatCompletionRequest) (*ChatCompletionResponse, error) { ersteller.Debug("mocking the mistral client") + if m.MockedContent == "" { + m.MockedContent = `{"name":"Meetup app","description":"An app to make notes for meetups","entities":[{"name":"Meetup","fields":[{"name":"name","type":"string"},{"name":"description","type":"string","longText":true},{"name":"date","type":"time"}],"entities":[{"name":"Notes","fields":[{"name":"title","type":"string"},{"name":"description","type":"string","longText":true}]}]}]}` + } response := ChatCompletionResponse{ Choices: []ChatCompletionChoice{ { Message: Message{ - Content: `{"name":"Meetup app","description":"An app to make notes for meetups","entities":[{"name":"Meetup","fields":[{"name":"name","type":"string"},{"name":"description","type":"string","longText":true},{"name":"date","type":"time"}],"entities":[{"name":"Notes","fields":[{"name":"title","type":"string"},{"name":"description","type":"string","longText":true}]}]}]}`, + Content: m.MockedContent, }, }, },