If you aren’t using JavaScript for your project, you can still use the REST API to invoke a deployment.

You can invoke a prompt deployment using Langtail’s Node.js SDK. Here’s how to get started.

1

Generate a code snippet

In Langtail, generate an SDK code snippet for your deployment:

  1. Navigate to the prompt you want to invoke.
  2. Click Deployments tab in the navigation bar.
  3. Next to the deployment you want to invoke, click the and then View Code.
  4. In the language selector, choose JavaScript SDK.
  5. If you don’t already have a Langtail project API key, you can generate one with the Get API Key button.
  6. Copy the snippet.
2

Install the Langtail SDK

In your project directory, install the SDK (using NPM or your package manager of choice):

npm add langtail
3

Paste and run

In your project, paste in the snippet from the first step and run your project. Check the Langtail logs to see if the request from your app was processed correctly.