Creating user profiles with schemas
# 📖tutorials
b
cc @dazzling-action-64106 After a conversation in yesterday's livestream, I wanted to share a technique for filling information in from a conversation to populate a user profile. Currently, the problem is that if you try to fill a schema-validated variable more than once, your bot will overwrite extant data with its most recent addition. This is the expected behaviour, but what if you want to create a user profile based on information provided throughout a conversation? We'll use the summary agent! The attached screenshot shows this working - essentially, we're just passing the conversation transcript through to the AI Task such that it can extract the data. You might run into issues as conversations get larger in size - let me know if this happens. https://cdn.discordapp.com/attachments/1242940260355280998/1242940261269508138/Screenshot_2024-05-22_at_4.40.13_PM.png?ex=664fa9d3&is=664e5853&hm=c85f382d53fa8b512a8b0d0fcbd516a446880e52101943407e071f90da1e8b47&
m
Hey @bumpy-butcher-41910 how did you make the bot ask for the missing information before populating the object? Like, you gave everything but the address so the bot asked for it before storing the results?
b
this was just an example, but you could set up a simple validation to check if any of the values of a variable are missing using an expression card found in flow logic
h
Hello BP team and fans! I hope you're doing great. I need HELP please: Can the schema properties be an 'array of objects'? I'm looking to the define a schema similar to the sample below. I also tried creating 3 different schemas but couldn't find a way to write it like that either. Thanks in advance for the help. id: string, name: string, price: number, optionsGroup: array { id: string, name: string, min: number, max: number, optionDefinition: object { id: string, name: string, extraPrice: number }
I was able to successfully write my schema with 3 levels, here's an example: zui.object({ id: zui.string(), title: zui.string(), description: zui.string(), price: zui.number(), imageUrl: zui.string().url(), categoryId: zui.string(), modGroups: zui.array( //modGroups array zui.object({ id: zui.string(), title: zui.string(), splitsAllowed: zui.number(), modMinReq: zui.number().min(NaN), modMaxReq: zui.number().max(10), modFreeQty: zui.number().max(10), modifiers: zui.array( //modifiers array zui.object({ id: zui.string(), title: zui.string(), extraPrice: zui.number(), isDefault: zui.boolean(), isIncluded: zui.boolean(), showForSplits: zui.boolean(), imageUrl: zui.string().url() })) //modifiers array })) //modGroups array })
33 Views