Skip to content

Commit

Permalink
Refactor profile schema and service to include user and products
Browse files Browse the repository at this point in the history
 - Rename `userDetails` to `user` in OpenAPI and service schema
 - Add `products` array to OpenAPI schema and service function
 - Update profile service to generate user profile based on services offered
  • Loading branch information
jamalsoueidan committed Jul 12, 2024
1 parent 05c7c60 commit f6212e7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
9 changes: 7 additions & 2 deletions openapi/paths/openai/profile/body.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ properties:
type: array
items:
type: string
userDetails:
user:
type: object
products:
type: array
items:
type: object
required:
- professions
- skills
- userDetails
- user
- products
3 changes: 2 additions & 1 deletion src/functions/openai/controllers/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export type OpenAIControllerProfileRequest = {
export const OpenAIControllerProfileSchema = z.object({
professions: z.array(z.string()),
skills: z.array(z.string()),
userDetails: z.object({}),
user: z.any(),
products: z.array(z.any()),
});

export type OpenaiProductCategorizeResponse = Awaited<
Expand Down
19 changes: 11 additions & 8 deletions src/functions/openai/services/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ type OpenAIServiceProfile = {
export const OpenAIServiceProfile = async ({
professions,
skills,
userDetails,
user,
products,
}: {
professions: any;
skills: any;
userDetails: any;
professions: string[];
skills: string[];
user?: any;
products: Array<any>;
}) => {
try {
const content = `
You are an assistant helping to create a user profile for a beauty professional. Use the provided information about the user's profession, skills, and other details to fill out the profile in the specified JSON format. Ensure the information is concise, accurate, and professional.
You are an assistant helping a beauty professional create a user profile on a beauty platform.
### Professions to choose from:
${JSON.stringify(professions, null, 2)}
Expand All @@ -31,12 +33,13 @@ ${JSON.stringify(professions, null, 2)}
${JSON.stringify(skills, null, 2)}
### User Details:
${JSON.stringify(userDetails, null, 2)}
${JSON.stringify(user, null, 2)}
The profession and skills should be determined based on the products offered. For example:
- If the products are related to hair styling, hair coloring, or bridal hair, select the profession as "hair_stylist" and relevant skills such as "balayage_specialist", "hair_coloring", and "bridal_makeup".
### User products details:
${JSON.stringify(products, null, 2)}
Write a short description and an about me section in Danish.
Choose user professions from the list above based on the user offering services. Only choose professions and skills related to the provided services.
Respond with this JSON structure:
Expand Down

0 comments on commit f6212e7

Please sign in to comment.