Follow the instructions below to install AgentMark in your app.
npm install @agentmark/agentmark-core @agentmark/vercel-ai-v4-adapter
yarn add @agentmark/agentmark-core @agentmark/vercel-ai-v4-adapter
--- name: example text_config: model_name: gpt-4o-mini --- <User>Hello World</User>
import { FileLoader } from "@agentmark/agentmark-core"; import { generateText } from "ai"; import { VercelAIModelRegistry, createAgentMarkClient } from "@agentmark/vercel-ai-v4-adapter"; // use any ai-sdk model provider import { openai } from "@ai-sdk/openai"; const modelRegistry = new VercelAIModelRegistry(); // register models you want to use modelRegistry.registerModels(['gpt-4o'], (name: string) => { return openai(name); }); const loader = new FileLoader('./path/to/prompts'); const agentmark = createAgentMarkClient({ loader, modelRegistry, }); const run = async () => { const examplePrompt = await agentmark.loadTextPrompt('<example>.prompt.mdx'); const props = { name: "Emily" }; const vercelInput = await examplePrompt.format({props}); const result = await generateText(vercelInput); console.log(result); } run();
import { generateText } from "ai"; import { VercelAIModelRegistry, createAgentMarkClient } from "@agentmark/vercel-ai-v4-adapter"; import { AgentMarkSDK } from "@agentmark/sdk"; // use any ai-sdk model provider import { openai } from "@ai-sdk/openai"; const modelRegistry = new VercelAIModelRegistry(); // register models you want to use modelRegistry.registerModels(['gpt-4o'], (name: string) => { return openai(name); }); const sdk = new AgentmarkClient({ apiKey: process.env.AGENTMARK_API_KEY!, appId: process.env.AGENTMARK_APP_ID! }); const agentmark = createAgentMarkClient({ loader: sdk.getFileLoader(), modelRegistry, }); const run = async () => { const examplePrompt = await agentmark.loadTextPrompt("<example>.prompt.mdx"); const props = { name: "Emily" }; const vercelInput = await examplePrompt.format({props}); const result = await generateText(vercelInput); console.log(result); } run();
We’re here to help! Choose the best way to reach us: