From 24c046ca2f88f318fc8f7132e864163224ff1e38 Mon Sep 17 00:00:00 2001 From: Brendan Quinn Date: Fri, 23 Aug 2024 20:28:01 +0000 Subject: [PATCH] Modifies system prompt to stop the LLM from wrapping responses in code blocks --- chat/src/helpers/prompts.py | 2 +- chat/test/helpers/test_metrics.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chat/src/helpers/prompts.py b/chat/src/helpers/prompts.py index dfa2f7c..0c6ba77 100644 --- a/chat/src/helpers/prompts.py +++ b/chat/src/helpers/prompts.py @@ -6,7 +6,7 @@ def prompt_template() -> str: Documents: {context} - Answer in raw markdown. When referencing a document by title, link to it using its UUID like this: [title](https://dc.library.northwestern.edu/items/UUID). For example: [Judy Collins, Jackson Hole Folk Festival](https://dc.library.northwestern.edu/items/f1ca513b-7d13-4af6-ad7b-8c7ffd1d3a37). Suggest keyword searches using this format: [keyword](https://dc.library.northwestern.edu/search?q=keyword). Offer a variety of search terms that cover different aspects of the topic. Include as many direct links to Digital Collections searches as necessary for a thorough study. The `collection` field contains information about the collection the document belongs to. In the summary, mention the top 1 or 2 collections, explain why they are relevant and link to them using the collection title and id: [collection['title']](https://dc.library.northwestern.edu/collections/collection['id']), for example [World War II Poster Collection](https://dc.library.northwestern.edu/collections/faf4f60e-78e0-4fbf-96ce-4ca8b4df597a): + Answer in raw markdown, but not within a code block. When referencing a document by title, link to it using its UUID like this: [title](https://dc.library.northwestern.edu/items/UUID). For example: [Judy Collins, Jackson Hole Folk Festival](https://dc.library.northwestern.edu/items/f1ca513b-7d13-4af6-ad7b-8c7ffd1d3a37). Suggest keyword searches using this format: [keyword](https://dc.library.northwestern.edu/search?q=keyword). Offer a variety of search terms that cover different aspects of the topic. Include as many direct links to Digital Collections searches as necessary for a thorough study. The `collection` field contains information about the collection the document belongs to. In the summary, mention the top 1 or 2 collections, explain why they are relevant and link to them using the collection title and id: [collection['title']](https://dc.library.northwestern.edu/collections/collection['id']), for example [World War II Poster Collection](https://dc.library.northwestern.edu/collections/faf4f60e-78e0-4fbf-96ce-4ca8b4df597a): Question: {question} diff --git a/chat/test/helpers/test_metrics.py b/chat/test/helpers/test_metrics.py index 885ee26..3cd8314 100644 --- a/chat/test/helpers/test_metrics.py +++ b/chat/test/helpers/test_metrics.py @@ -99,10 +99,10 @@ def test_token_usage(self): expected_result = { "answer": 12, - "prompt": 322, + "prompt": 329, "question": 5, "source_documents": 527, - "total": 866 + "total": 873 } self.assertEqual(result, expected_result)