Provide Context from Your Project
Last updated
Last updated
AI models work better when they have context about your specific project or data structures. Nyvo allows you to iterate on prompts, so you can feed in context like existing code snippets, interface definitions, or data schemas to help the AI generate code that fits seamlessly with your dApp. For example, if your dApp will use a certain account structure, you should share that with the AI up front. You might say, “We have an account struct TokenAccount
with fields balance: u64
and is_initialized: bool
.” By providing that, the AI will know to use those exact field names instead of making something up. This leads to more accurate and consistent code integration.
How to provide context: You can paste relevant struct or interface definitions into your prompt, or describe them in detail. For instance, include a snippet of an Anchor account struct or a TypeScript type that the AI’s output should interact with. This helps the AI align to your naming conventions and avoids mistakes like using wrong data types or field names. It also reduces the integration work on your end – the AI’s code will more likely drop into your codebase without heavy rewrites.
Don’t overload the AI. While context is useful, too much can backfire. Supplying the entire codebase or very large files can confuse the model or cause it to produce irrelevant or erroneous output. Focus on the most relevant pieces of context: e.g., a function signature it should use, a struct definition, or the outline of your module. Keeping the prompt streamlined helps maintain accuracy.
In one real example, testers of a Solana AI tool found that giving an overly large input (like a full RSS feed) caused the generation to fail with syntax errors. The lesson: stick to the key details the AI needs to know, rather than everything. If Nyvo’s AI needs more information, you can always iterate by providing additional context in a follow-up prompt.