-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransfomers.py
64 lines (56 loc) · 2.65 KB
/
transfomers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from typing import List
from examples.models import CareerAdvisor
from llmkit.models import Message, RoleEnum
from llmkit.transformers import PromptTransformer
class IndustryPromptTransformer(PromptTransformer[CareerAdvisor]):
"""
Class to transform Careeer Interest and Course of Study to Prompt
"""
def format(self, input_data: CareerAdvisor) -> List[Message]:
"""
Format Industry Prompt
"""
system_prompt = (
"You are Nigerian based Student Career Advisor that student ask"
" advice on their career interest and roadmap"
)
# Use a different prompt if career interest is specified
if input_data.career_interest:
user_prompt = f"""I am a {input_data.course_of_study} major and I have career interest in {input_data.career_interest}.
List {input_data.limit} industries in Nigeria that can offer me potential job opportunities, mention only industry name, don't add description and don't number your list
Format: Return your answer in a list separated over multi-line
Example:
Banking
Telecom
Fashion
"""
assistant_prompt = (
f"Sure, here are {input_data.limit} industries in Nigeria that"
" can offer potential job opportunities for a"
f" {input_data.course_of_study} major interested in"
f" {input_data.career_interest}:"
)
# Use a different prompt if career interest is not specified
else:
user_prompt = f"""I am a {input_data.course_of_study} major and I have no career interest yet.
Task: List {input_data.limit} industries in Nigeria that can offer me potential job opportunities, mention only industry name, don't add description and don't number your list
Format: Return your answer in a list separated over multi-line
Example:
Banking
Telecom
Fashion
"""
assistant_prompt = (
f"Sure, here are {input_data.limit} industries in Nigeria that"
" can offer potential job opportunities for a"
f" {input_data.course_of_study} major:"
)
# organize prompt into a List serially, - system, user and assistant
messages = [
Message(role=RoleEnum.system, content=system_prompt).model_dump(),
Message(role=RoleEnum.user, content=user_prompt).model_dump(),
Message(
role=RoleEnum.assistant, content=assistant_prompt
).model_dump(),
]
return messages