From cc3063473e8edaba5c5c822dfcc46aa5bf9a80d6 Mon Sep 17 00:00:00 2001 From: Edward Ly Date: Mon, 9 Dec 2024 08:22:07 -0800 Subject: [PATCH] fix(OpenAiProviderTest): update summary prompt Signed-off-by: Edward Ly --- tests/unit/Providers/OpenAiProviderTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/Providers/OpenAiProviderTest.php b/tests/unit/Providers/OpenAiProviderTest.php index f840977..857a857 100644 --- a/tests/unit/Providers/OpenAiProviderTest.php +++ b/tests/unit/Providers/OpenAiProviderTest.php @@ -307,8 +307,8 @@ public function testSummaryProvider(): void { $url = self::OPENAI_API_BASE . 'chat/completions'; $options = ['timeout' => Application::OPENAI_DEFAULT_REQUEST_TIMEOUT, 'headers' => ['User-Agent' => Application::USER_AGENT, 'Authorization' => self::AUTHORIZATION_HEADER, 'Content-Type' => 'application/json']]; - $message = 'Summarize the following text. Detect the language of the text. Use the same language as the text. Output only the summary. Here is the text:' . "\n\n" . $prompt . "\n\n" . 'Here is your summary in the same language as the text:'; - $options['body'] = json_encode(['model' => Application::DEFAULT_COMPLETION_MODEL_ID, 'messages' => [['role' => 'user', 'content' => $message]], 'max_tokens' => Application::DEFAULT_MAX_NUM_OF_TOKENS, 'n' => $n, 'user' => self::TEST_USER1]); + $systemPrompt = 'Summarize the following text in the same language as the text.'; + $options['body'] = json_encode(['model' => Application::DEFAULT_COMPLETION_MODEL_ID, 'messages' => [['role' => 'system', 'content' => $systemPrompt], ['role' => 'user', 'content' => $prompt]], 'max_tokens' => Application::DEFAULT_MAX_NUM_OF_TOKENS, 'n' => $n, 'user' => self::TEST_USER1]); $iResponse = $this->createMock(\OCP\Http\Client\IResponse::class); $iResponse->method('getBody')->willReturn($response);