quickstarts/conversation/javascript/http
Elena Kolevska 5e711424d6
Removes 1-15 prefix for docs (#1171)
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Co-authored-by: Yaron Schneider <schneider.yaron@live.com>
2025-02-27 10:39:56 -08:00
..
conversation Conversation quickstarts updates - Python and Go (#1169) 2025-02-27 08:29:23 -08:00
README.md Removes 1-15 prefix for docs (#1171) 2025-02-27 10:39:56 -08:00
dapr.yaml Conversation JS HTTP Quickstart (#1154) 2025-02-04 13:15:18 -08:00
makefile Conversation JS HTTP Quickstart (#1154) 2025-02-04 13:15:18 -08:00

README.md

Dapr Conversation API (JS HTTP)

In this quickstart, you'll send an input to a mock Large Language Model (LLM) using Dapr's Conversation API. This API is responsible for providing one consistent API entry point to talk to underlying LLM providers.

Visit this link for more information about Dapr and the Conversation API.

Note: This example leverages HTTP requests only.

This quickstart includes one app:

  • index.js, responsible for sending an input to the underlying LLM and retrieving an output.

Run the app with the template file

This section shows how to run the application using the multi-app run template files with dapr run -f ..

This example uses the default LLM Component provided by Dapr which simply echoes the input provided, for testing purposes. Here are other supported Conversation components.

  1. Install dependencies:
cd ./conversation
npm install
  1. Open a new terminal window and run the multi app run template:
dapr run -f .

The terminal console output should look similar to this, where:

  • The app sends an input What is dapr? to the echo Component mock LLM.
  • The mock LLM echoes What is dapr?.
== APP - conversation == Input sent: What is dapr?
== APP - conversation == Output response: What is dapr?
  1. Stop and clean up application processes.
dapr stop -f .

Run the app individually

  1. Open a terminal and navigate to the conversation app. Install the dependencies if you haven't already.
cd ./conversation
npm install
  1. Run the Dapr process alongside the application.
dapr run --app-id conversation --resources-path ../../../components/ -- npm run start

The terminal console output should look similar to this, where:

  • The app sends an input What is dapr? to the echo Component mock LLM.
  • The mock LLM echoes What is dapr?.
== APP - conversation == Input sent: What is dapr?
== APP - conversation == Output response: What is dapr?