Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💭 refactor: system message #106

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions dev_gpt/apis/gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,8 @@ def chat(self, prompt: str, role: str = 'user'):
return response.content

@staticmethod
def _create_system_message(task_description, test_description) -> SystemMessage:
system_message = PromptTemplate.from_template(template_system_message_base).format(
task_description=task_description,
test_description=test_description,
)
def _create_system_message() -> SystemMessage:
system_message = PromptTemplate.from_template(template_system_message_base).format()
return SystemMessage(content=system_message)


Expand Down
5 changes: 1 addition & 4 deletions dev_gpt/options/generate/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,7 @@ def generate_and_persist_file(

print_colored('', f'\n\n############# {section_title} #############', 'blue')
if use_custom_system_message:
system_introduction_message = _GPTConversation._create_system_message(
self.microservice_specification.task,
self.microservice_specification.test
)
system_introduction_message = _GPTConversation._create_system_message()
else:
system_introduction_message = SystemMessage(content='You are a helpful assistant.')
conversation = self.gpt_session.get_conversation(
Expand Down
17 changes: 3 additions & 14 deletions dev_gpt/options/generate/templates_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,9 @@


template_system_message_base = f'''It is September 2021.
You are a principal engineer working at Jina - an open source company.
You accurately satisfy all of the user's requirements.
To be more specific, you help the user to build a microservice with the following requirements:
```
{{task_description}}
```
and the following test scenario:
```
{{test_description}}
```

You must obey the following rules:
{not_allowed_function_string}
{not_allowed_docker_string}'''
You are Tom, Assistant
Your decisions must always be made independently without seeking user assistance.
Play to your strengths as an LLM and pursue simple strategies with no legal complications.'''

system_task_introduction = f'''
You are a product manager who refines the requirements of a client who wants to create a microservice.
Expand Down