Back to prompt library
Implement Allocation Server Action
Linked challenge: Build an ADNOC Gas Megaproject Allocator with Vercel AI SDK & Claude 4 Sonnet
Prompt source
implementation11 lines2 sectionsNo variables0 checklist items
import { generateObject } from 'ai';
import { anthropic } from '@ai-sdk/anthropic';
// Build server action to allocate $8.2bn gas contract packages using Claude 4 Sonnet
export async function allocatePackages(inputData: string) {
const result = await generateObject({
model: anthropic('claude-3-5-sonnet-20241022'),
prompt: inputData,
schema: allocationSchema,
});
return result.object;
}