Skip to content

Commit

Permalink
add some bounding on the prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
devksingh4 committed Jul 20, 2024
1 parent 3adc92a commit c362921
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const GenerateProfileModal: React.FC<GenerateProfileModalProps> = ({
/>
<TextInput
label="Desired Job Functions"
description="Comma-seperated list, e.g. 'Full-Stack Development, DevOps'"
description="Comma-seperated list of keywords (max 300 characters)."
withAsterisk
key={form.key('roleKeywords')}
{...form.getInputProps('roleKeywords')}
Expand Down
6 changes: 6 additions & 0 deletions code/util/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ def student_gpt():
try:
username = app.current_event.request_context.authorizer["username"]
data = GenerateProfileRequest(**json_body).model_dump()
if len(''.join(data['roleKeywords'])) > 300:
return Response(
status_code=403,
content_type=content_types.APPLICATION_JSON,
body={"message": "Error validating profile generation payload", "details": "Role keywords are too long."}
)
response = oai_get_profile_json(openai_client, data['resumeText'], data['roleType'], ','.join(data['roleKeywords']))
response['username'] = username
if 'email' not in response or response['email'] == '':
Expand Down

0 comments on commit c362921

Please sign in to comment.