dify/sdks/nodejs-client
crazywoola 2a68bfbc84 feat: add keywords 2023-05-12 10:57:56 +08:00
..
.gitignore feat: nodejs sdk 2023-04-17 11:05:54 +08:00
README.md chore: chat and text generatior same api direction 2023-04-17 17:22:28 +08:00
index.js feat: remove unused comments 2023-05-12 10:57:13 +08:00
package.json feat: add keywords 2023-05-12 10:57:56 +08:00

README.md

LangGenius Node.js SDK

This is the Node.js SDK for the LangGenius API, which allows you to easily integrate LangGenius into your Node.js applications.

Install

npm install langgenius-client

Usage

After installing the SDK, you can use it in your project like this:

import { LangGeniusClient, ChatClient, CompletionClient } from 'langgenius-client'

const API_KEY = 'your-api-key-here';
const APP_ID = 'your-app-id-here';
const user = `user_${APP_ID}:user_id`:

// Create a completion client
const completionClient = new CompletionClient(API_KEY)
// Create a completion message
completionClient.createCompletionMessage(inputs, query, responseMode, user)

// Create a chat client
const chatClient = new ChatClient(API_KEY)
// Create a chat message
chatClient.createChatMessage(inputs, query, responseMode, user, conversationId)
// Fetch conversations
chatClient.getConversations(user)
// Fetch conversation messages
chatClient.getConversationMessages(conversationId, user)
// Rename conversation
chatClient.renameConversation(conversationId, name, user)


const langGeniusClient = new LangGeniusClient(API_KEY)
// Fetch application parameters
langGeniusClient.getApplicationParameters(user)
// Provide feedback for a message
langGeniusClient.messageFeedback(messageId, rating, user)

Replace 'your-api-key-here' with your actual LangGenius API key.Replace 'your-app-id-here' with your actual LangGenius APP ID.

License

This SDK is released under the MIT License.