From bb56214a53966eb454683b11050981d1117de5df Mon Sep 17 00:00:00 2001 From: Paul Payne Date: Fri, 13 Dec 2024 21:23:56 +0000 Subject: [PATCH] Fix import paths. --- .../chat_completions/fix_agenda_error.py | 5 +++-- .../chat_completions/fix_artifact_error.py | 2 +- .../chat_completions/generate_artifact_updates.py | 4 ++-- .../chat_completions/generate_message.py | 4 ++-- .../chat_completions/update_agenda.py | 7 ++++--- .../guided_conversation_skill/tests/test_final_update.py | 2 +- .../tests/test_generate_agenday.py | 2 +- .../tests/test_generate_artifact_updates.py | 2 +- .../guided_conversation_skill/tests/test_resource.py | 2 +- 9 files changed, 16 insertions(+), 14 deletions(-) diff --git a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/fix_agenda_error.py b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/fix_agenda_error.py index cb7ee4ea..e149177b 100644 --- a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/fix_agenda_error.py +++ b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/fix_agenda_error.py @@ -16,7 +16,8 @@ logger = logging.getLogger(__name__) -AGENDA_ERROR_CORRECTION_SYSTEM_TEMPLATE = """You are a helpful, thoughtful, and meticulous assistant. +AGENDA_ERROR_CORRECTION_SYSTEM_TEMPLATE = """ +You are a helpful, thoughtful, and meticulous assistant. You are conducting a conversation with a user. You tried to update the agenda, but the update was invalid. You will be provided the history of your conversation with the user, your previous attempt(s) at updating the agenda, and the error message(s) that resulted from your attempt(s). @@ -29,7 +30,7 @@ 1. You should not change the description of the first item (since it has already been executed), but you can change its resource allocation. 2. For all other items, you can combine or split them, or assign them fewer or more resources, but the content they cover collectively should not change (i.e. don't eliminate or add new topics). For example, the invalid attempt was "item 1 = ask for date of birth (1 turn), item 2 = ask for phone number (1 turn), item 3 = ask for phone type (1 turn), item 4 = explore treatment history (6 turns)", and the error says you need to correct the total resource allocation to 7 turns. A bad solution is "item 1 = ask for date of birth (1 turn), item 2 = explore treatment history (6 turns)" because it eliminates the phone number and phone type topics. A good solution is "item 1 = ask for date of birth (2 turns), item 2 = ask for phone number, phone type, and treatment history (2 turns), item 3 = explore treatment history (3 turns)." -""" +""".replace("\n\n\n", "\n\n").strip() async def fix_agenda_error( diff --git a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/fix_artifact_error.py b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/fix_artifact_error.py index f1f161ec..b2b64533 100644 --- a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/fix_artifact_error.py +++ b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/fix_artifact_error.py @@ -33,7 +33,7 @@ - You should pick this action if: (a) you do NOT have a valid value to submit for the field in question, and (b) you need to ask the user for more information in order to obtain a valid value. For example, if the user stated that their date of birth is June 2000, but the artifact field asks for the date of birth in the format "YYYY-MM-DD", you should resume the conversation and ask the user for the day. Return only the action, either UPDATE_ARTIFACT(value) or RESUME_CONVERSATION, as your response. If you selected, UPDATE_ARTIFACT, make sure to replace "value" with the correct value. -""".replace("\n\n\n", "\n\n") +""".replace("\n\n\n", "\n\n").strip() async def generate_artifact_field_update_error_fix( diff --git a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/generate_artifact_updates.py b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/generate_artifact_updates.py index f9ce6fbd..1b2574b8 100644 --- a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/generate_artifact_updates.py +++ b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/generate_artifact_updates.py @@ -11,7 +11,7 @@ validate_field_presence_in_schema, validate_field_value, ) -from guided_conversation_skill.definition import ConversationGuide +from guided_conversation_skill.guide import ConversationGuide from openai_client import ( CompletionError, add_serializable_data, @@ -61,7 +61,7 @@ - If the user's message contains no information relevant to updating the artifact, you should not create any field updates. For example, if the user sends a message that says "Hello" or "Goodbye", you should not create any field updates. Your task is to state your step-by-step reasoning for the best possible action(s), followed by a final recommendation of which update(s) to make, including all required parameters. Someone else will be responsible for executing the update(s) you select and they will only have access to your output (not any of the conversation history, artifact schema, or other context) so it is EXTREMELY important that you clearly specify the value of all required parameters for each update you make. -""".replace("\n\n\n", "\n\n") +""".replace("\n\n\n", "\n\n").strip() class ArtifactUpdate(BaseModel): diff --git a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/generate_message.py b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/generate_message.py index 9f883774..815c9bad 100644 --- a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/generate_message.py +++ b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/generate_message.py @@ -2,7 +2,7 @@ from typing import Any from guided_conversation_skill.artifact_helpers import get_artifact_for_prompt, get_schema_for_prompt -from guided_conversation_skill.definition import ConversationGuide +from guided_conversation_skill.guide import ConversationGuide from openai_client import ( CompletionError, add_serializable_data, @@ -42,7 +42,7 @@ For example, if the artifact schema indicates that the "date of birth" field must be in the format "YYYY-MM-DD", but the user has only provided the month and year, you should send a message to the user asking for the day. Likewise, if the user claims that their date of birth is February 30, you should send a message to the user asking for a valid date. If the artifact schema is open-ended (e.g. it asks you to rate how pressing the user's issue is, without specifying rules for doing so), use your best judgment to determine whether you have enough information or you need to continue probing the user. It's important to be thorough, but also to avoid asking the user for unnecessary information. -""".replace("\n\n\n", "\n\n") +""".replace("\n\n\n", "\n\n").strip() class ArtifactUpdate(BaseModel): diff --git a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/update_agenda.py b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/update_agenda.py index f11807f9..6a7efb31 100644 --- a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/update_agenda.py +++ b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/chat_completions/update_agenda.py @@ -8,7 +8,7 @@ from guided_conversation_skill.agenda import Agenda, AgendaItem from guided_conversation_skill.artifact_helpers import get_artifact_for_prompt -from guided_conversation_skill.definition import ConversationGuide +from guided_conversation_skill.guide import ConversationGuide from guided_conversation_skill.message import Conversation from guided_conversation_skill.resources import ( GCResource, @@ -32,7 +32,8 @@ logger = logging.getLogger(__name__) -GENERATE_AGENDA_TEMPLATE = """You are a helpful, thoughtful, and meticulous assistant. You are conducting a conversation with a user. Your goal is to complete an artifact as thoroughly as possible by the end of the conversation, and to ensure a smooth experience for the user. +GENERATE_AGENDA_TEMPLATE = """ +You are a helpful, thoughtful, and meticulous assistant. You are conducting a conversation with a user. Your goal is to complete an artifact as thoroughly as possible by the end of the conversation, and to ensure a smooth experience for the user. This is the schema of the artifact you are completing: {{ artifact_schema }} @@ -65,7 +66,7 @@ - Do NOT include wrap-up items such as "review and confirm all information with the user" (you should be doing this throughout the conversation) or "thank the user for their time". Do NOT repeat topics that have already been sufficiently addressed. {{ ample_time_str }} When you determine the conversation is completed, just return an agenda with no items in it. -""".replace("\n\n\n", "\n\n") +""".replace("\n\n\n", "\n\n").strip() def _get_termination_instructions(resource: GCResource): diff --git a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_final_update.py b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_final_update.py index 65782580..46de6e6e 100644 --- a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_final_update.py +++ b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_final_update.py @@ -1,6 +1,6 @@ import pytest from guided_conversation_skill.chat_completions.final_artifact_update import final_artifact_update -from guided_conversation_skill.definitions import acrostic_poem +from guided_conversation_skill.conversation_guides import acrostic_poem from guided_conversation_skill.message import Conversation, Message from skill_library.types import LanguageModel diff --git a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_generate_agenday.py b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_generate_agenday.py index 3ec9ea40..c30b7b5e 100644 --- a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_generate_agenday.py +++ b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_generate_agenday.py @@ -1,7 +1,7 @@ import pytest from guided_conversation_skill.agenda import Agenda from guided_conversation_skill.chat_completions.update_agenda import generate_agenda -from guided_conversation_skill.definitions import acrostic_poem +from guided_conversation_skill.conversation_guides import acrostic_poem from guided_conversation_skill.message import Conversation from guided_conversation_skill.resources import GCResource from skill_library.types import LanguageModel diff --git a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_generate_artifact_updates.py b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_generate_artifact_updates.py index 39f72e8d..b963717c 100644 --- a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_generate_artifact_updates.py +++ b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_generate_artifact_updates.py @@ -1,6 +1,6 @@ import pytest from guided_conversation_skill.chat_completions.generate_artifact_updates import generate_artifact_updates -from guided_conversation_skill.definitions.acrostic_poem import definition +from guided_conversation_skill.conversation_guides.acrostic_poem import definition from guided_conversation_skill.message import Conversation from skill_library.types import LanguageModel diff --git a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_resource.py b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_resource.py index 0f97de61..49627f71 100644 --- a/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_resource.py +++ b/libraries/python/skills/skills/guided-conversation-skill/guided_conversation_skill/tests/test_resource.py @@ -1,7 +1,7 @@ from guided_conversation_skill.resources import GCResource, ResourceConstraintMode, ResourceConstraintUnit -async def test_resource_init() -> None: +def test_resource_init() -> None: data = { "resource_constraint": { "mode": "maximum",