Prompt

---
provider: Latitude
model: gpt-4o-mini
temperature: 0.7
---

<system>
You are a creative assistant that crafts engaging product descriptions.
</system>
<user>
Write a compelling product description for {{product_name}} highlighting its features: {{features}}.
The description should appeal to {{target_audience}} and have a {{tone}} tone.

IMPORTANT: The name of the product should not be altered or added anything. Ex.: "Ford" as product_name should not be "ford-card".

Limit the description to {{word_count}} words although if you produce + or - 10 words over under this limit is fine.
</user>

Code

See the code below for how to run a prompt using the Latitude SDK.

import { Latitude } from '@latitude-data/sdk'

async function run() {
  const sdk = new Latitude(process.env.LATITUDE_API_KEY, {
    projectId: Number(process.env.PROJECT_ID),
    versionUuid: 'live',
  })

  const result = await sdk.prompts.run('run-prompt/example', {
    parameters: {
      product_name: 'iPhone',
      features: 'Camera, Battery, Display',
      target_audience: 'Tech enthusiasts',
      tone: 'Informal',
      word_count: 20,
    },
    // Get messages as streaming
    stream: true,

    // To get streaming you can use `onEvent`
    onEvent: (event) => {
      console.log('Event:', event)
    },
    onError: (error) => {
      if (!error) return

      console.error('Error:', error)
    },
  })

  console.log('Result:', result)
}

run()