Reactive Machines

Organized results with Amazon NVA: Chicken Guide

Developers build AI application programs facing the standard challenge: To convert unfried data into formal formats. The formal release is important to be used for machine use in the machine to use the machine, because this enables river use cases to effectively complete and process the results produced. Even if it releases information from the documents, creating assistants that make data from api, or developing agents need the action, these activities require basic models to produce some formal formats.

We have introduced compulsory deduction to provide honesty when using systematic order tools. Now, tools can be used with amazon Nova Founds (FMS) to remove data based on complex Schemas, reduce the tool use the errors using more than 95%.

In this post, we check how to use Amazon Nova FM charges of organized use.

Techniques to use organized results

When you face the needs of organized effects use cases, there are two common initiatives. You can quickly modify the system or use toolbar to make the tool. For example, in the Customer Support trial, you can want the model to release JSON for its response to the current user. Therefore, System Prompt will be changed to enter the expected building:

Make sure your final response is valid JSON that follows the below response schema: 

##Response schema
```json
{
   "response": "the response to the customer",
   "sentiment": "the current customer sentiment"
}```

Another option is to provide tool configuration. Driving Tool to provide API, the work code, or schema (or structure) required by your final application with the Application Scheme with API application schemes with an API application schema with an Application Scheme with an Application Scheme with API application. This is especially used in the construction of Agentic programs but often used in formal use cases due to the ability to define the specified SCHEMA to follow.

tool_config = {
    "tools": [ 
        {
            "toolSpec": {
                "name": "respondToUser",
                "description": "the formatted response to the customer",
                "inputSchema": {
                    "type": "object",
                    "properties": {
                        "response": {
                            "description": "the response to the customer",
                            "type": "string"
                        },
                        "sentiment": {
                            "description": "the current customer sentiment",
                            "type": "string"
                        }
                    },
                    "required": [
                        "response",
                        "sentiment"
                    ]
                }
            }
        }
    ]
}

Both methods may be effective promotion strategies to influence the model. However, the result is not doing and there is a place of failure. In our work and customers to use the use of cases such as the Agentic's operations and formal application, we have seen that the accuracy of the model usually decreases as the greater is more sophisticated.

Formal Issue and Amazon Nova models

Based on this reading, we have used compulsory constipation to our system to help ensure the highest modeling reliability of the production and allowing the model to carry soft schemas easily. Mandatory decorating to rely on the app to pressure Possible tokens the model can emptify each step. This is divided from the strategies to promote historical use, because this changes real tokens the model can choose when creating exits. For example, when you close the JSON item, the model will be forced to } token to select. Any intended decoration is used every time the suspension of tools is transferred. Because the use of tools provides a specific schema, we can use that to produce a forceful system, based on the desirable schema by developer. Mandatory decoration prevents model to produce unauthorized keys and enforce relevant data types based on the specified schema.

The process of explaining schema

Step the key to using a formal effects with Amazon Nova create activation of tools. Tools configuration provides a common interface to describe the expected optimum output. While the original tool of equipment configuration to provide external operations in the model, this JVS display is used in formal use cases. This can be displayed using a case of use issuing content from online content. Starting the integration, making the suspension of tools to represent some fields we want to be released from the invoices. When creating tools is created, it is important to specify and short because the words and explanations of property is that it informs the model that the fields should be filled.

tool_config = {
   "tools": [
        {
            "toolSpec": {
                "name": "extract_recipe",
                "description": "Extract recipe for cooking instructions",
                "inputSchema": {
                    "json": {
                        "type": "object",
                        "properties": {
                            "recipe": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "Name of the recipe"
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Brief description of the dish"
                                    },
                                    "prep_time": {
                                        "type": "integer",
                                        "description": "Preparation time in minutes"
                                    },
                                    "cook_time": {
                                        "type": "integer",
                                        "description": "Cooking time in minutes"
                                    },
                                    "servings": {
                                        "type": "integer",
                                        "description": "Number of servings"
                                    },
                                    "difficulty": {
                                        "type": "string",
                                        "enum": [
                                            "easy",
                                            "medium",
                                            "hard"
                                        ],
                                        "description": "Difficulty level of the recipe"
                                    },
                                    "ingredients": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "name": {
                                                    "type": "string",
                                                    "description": "Name of ingredient"
                                                },
                                                "amount": {
                                                    "type": "number",
                                                    "description": "Quantity of ingredient"
                                                },
                                                "unit": {
                                                    "type": "string",
                                                    "description": "Unit of measurement"
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "amount",
                                                "unit"
                                            ]
                                        }
                                    },
                                    "instructions": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "description": "Step-by-step cooking instructions"
                                        }
                                    },
                                    "tags": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "description": "Categories or labels for the recipe"
                                        }
                                    }
                                },
                                "required": [
                               ]
                            }
                        },
                        "required": [
                        ]
                    }
                }
            }
        }
    ]
}

After the suspension of tools is created, we can pass it on a molten api and recipe, which will be available on the user's Demplter. A prompt system is required by the formal use of cases to direct the model for how to remove content, this can use it to pass the application role in the system and persona.

import boto3

model_response = client.converse(
    modelId="us.amazon.nova-lite-v1:0",
   system=[{"text": "You are an expert recipe extractor that compiles recipe details from blog posts"}],
    messages=[{"role": "user", "content": content}],
    inferenceConfig={"temperature": 0},
    toolConfig=tool_config
)

By using a traditional tool for compulsory decoding support, we receive a molded device call that will follow the appropriate syntax and the expected schema as set to tool configuration.

{
    "toolUse": {
        "toolUseId": "tooluse_HDCl-Y8gRa6yWTU-eE97xg",
        "name": "extract_recipe",
        "input": {
            "recipe": {
                "name": "Piacenza Tortelli",
                "description": "Piacenza tortelli, also known as 'tortelli with the tail' due to their elongated shape, are a delicious fresh pasta, easy to make at home!",
                "prep_time": 60,
                "cook_time": 10,
                "servings": 4,
                "difficulty": "hard",
                "ingredients": [
                    {
                        "name": "Type 00 flour",
                        "amount": 2.3,
                        "unit": "cups"
                    },
                    {
                        "name": "Eggs",
                        "amount": 3,
                        "unit": ""
                    },
                    {
                        "name": "Fine salt",
                        "amount": 1,
                        "unit": "pinch"
                    },
                    {
                        "name": "Spinach",
                        "amount": 13.3,
                        "unit": "cups"
                    },
                    {
                        "name": "Cow's milk ricotta cheese",
                        "amount": 1.3,
                        "unit": "cups"
                    },
                    {
                        "name": "Parmigiano Reggiano PDO cheese",
                        "amount": 4.2,
                        "unit": "oz"
                    },
                    {
                        "name": "Fine salt",
                        "amount": 1,
                        "unit": "to taste"
                    },
                    {
                        "name": "Nutmeg",
                        "amount": 1,
                        "unit": "to taste"
                    },
                    {
                        "name": "Butter",
                        "amount": 80,
                        "unit": "g"
                    },
                    {
                        "name": "Sage",
                        "amount": 2,
                        "unit": "sprigs"
                    }
                ],
                "instructions": [
                    "Arrange the flour in a mound and pour the eggs into the center 1; add a pinch of salt and start working with a fork 2, then knead by hand 3.",
                    "You should obtain a smooth dough 4; wrap it in plastic wrap and let it rest for half an hour in a cool place.",
                    "Meanwhile, prepare the filling starting with the spinach: immerse them in boiling salted water 5 and blanch them for a few minutes until wilted 6.",
                    "Drain the spinach and transfer them to cold water 7, preferably with ice. Then squeeze them very well 8 and chop them finely with a knife 9.",
                    "Place the chopped spinach in a bowl, add the ricotta 10, salt, pepper, and nutmeg 11. Also add the grated Parmigiano Reggiano DOP 12.",
                    "Mix well until you get a homogeneous consistency 13.",
                    "At this point, take the dough that has now rested 14, take a portion of it keeping the rest covered. Lightly flatten the dough with a rolling pin 15.",
                    "Roll it out with a pasta machine 16; as you reduce the thickness, fold the dough over itself 17 and roll it out again 18.",
                    "You should get a very thin rectangle, about 0.04-0.08 inches thick 19. Cut 2 strips of dough by dividing the rectangle in half lengthwise 20, then cut out diamonds of 4 inches 21.",
                    "Fill the diamonds with the spinach filling 22 and close them. To do this, bring one of the two longer points inward 23, then fold the two side points towards the center 24.",
                    "Now close the tortello by pinching the dough in the center and moving gradually towards the outside 25. The movement is similar to the closure of culurgiones. Continue in this way until the dough and filling are finished 26; you will get about 40-45 pieces.",
                    "Place a pot full of salted water on the stove. Meanwhile, in a pan, pour the butter and sage 27. Turn on the heat and let it flavor.",
                    "Then cook the tortelli for 5-6 minutes 28, then drain them and toss them in the butter and sage sauce 29.",
                    "Plate and serve the Piacenza tortelli with plenty of grated Parmigiano Reggiano DOP 30!"
                ],
                "tags": [
                    "vegetarian",
                    "Italian"
                ]
            }
        }
    }
}

Now, by compulsory constipation, we can use a small model such as Amazon Nova Lite to remove the biggest and complex Jon Schema to use it in our application. Photographic charges based on image and complex Schemas, we recommend that you use Nova pro or Nova Nova Premier for the best work.

Store

Using the formal issue with Amazon Nova through toolbar, you can take advantage of important decorations that are compulsory and build a reliable system. We encourage you to try this on your requests today. Learn more from the AMAZON NOVANIA directory. Get started building your AI apps with Amazon Nova at Amazon Bedrock Console.


About the authors

Jean farmer Is the construction of the AI solutions made from the Amazon Artificial General Intelligence (Agi) a group, special to Agentic applications. Based on Seattle, Washington, works in the communication of the independent AI and practical business systems, helps sharing the future of AGI in Amazon.

Muzund Birje by the SR administrator. Product Marketing Manager on AIML TEAM AWS. In her current role you focus on the outgoing of Amazon Nova Foundation Model. She is over 10 years of marketing experiences and sealing in different types. Without work you can find him walking, reading, and trying new restaurants. You can connect with him on the LinkedIn.

Source link

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button