smartcomponents
smartcomponents copied to clipboard
SmartPaste: Array And AllowedValues With Id
I'm creating product
AllowedValues With Id
Product have categories and categories have name and id and what i care about is id
Array
Product have units a one, box whatever and this array is the units of the product Why it's not allowedValues it have unitPrice, unitName, unitEqualivant and more So array is important please
Thanks for posting. To clarify what you're asking for, could you post an example of the code you think you'd want to write?
1. Handling Allowed Values with ID
Class Definition for Product:
public class Product
{
public int CategoryId { get; set; }
}
In this scenario, CategoryId is an integer that should correspond to a predefined list of allowed category values. The allowed values are defined as follows:
| Name | Id |
|---|---|
| Studying | 1 |
| Tech | 2 |
When the AI processes a prompt, it should fill the CategoryId property with the corresponding ID from the allowed values, based on the given category name.
Example Prompt:
Make me a product with name pencil with category Studying
The AI should understand this prompt and set CategoryId to 1 for the product named "pencil" because "Studying" corresponds to 1.
2. Handling Arrays
Class Definition for Order:
public class Order
{
public List<OrderItem> Items { get; set; }
}
public class OrderItem
{
public int ProductId { get; set; }
public int Qty { get; set; }
public decimal Price { get; set; }
}
In this scenario, ProductId should use the allowed values from the previously defined categories.
Example Prompt:
Make me this order with 2 pencils and one notebook
The AI should parse this prompt and create an Order object containing OrderItem objects with the appropriate ProductIds and quantities. It should identify the products (e.g., "pencil" and "notebook") and assign the correct ProductId based on the allowed values.
Summary
- Allowed Values with ID: The AI should map category names to their respective IDs when filling the
CategoryIdproperty in theProductclass. - Array Handling: The AI should create
Orderobjects withOrderItementries, using the predefined product IDs for each item in the order based on the prompt.
I'm afraid I don't understand how this relates to Smart Paste. Since Smart Paste only populates HTML forms and does not provide any .NET objects, I'm not sure how these code examples relate to it.
Similarly, you give an example of a prompt "Make me a product with name pencil with category Studying", but what does that mean in this context? Smart Paste doesn't accept any prompts at all.
Could you clarify? Or are you just asking a more general question about AI?
Okay are there open source of this library or anything I can collaborate or a repo that i can pull request cause i got it but i need just small help but i did 60% percent from it but it only works with gpt4o and gpt3.5 does not understand it so i need little help with my system prompt