Skip to content

Commit

Permalink
Fix import paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
payneio committed Dec 13, 2024
1 parent 107712e commit bb56214
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 }}
Expand Down Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit bb56214

Please sign in to comment.