You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gcgj-dify-1.7.0/sdks/nodejs-client/README.md

47 lines
1.5 KiB
Markdown

# 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
```bash
npm install langgenius-client
```
## Usage
After installing the SDK, you can use it in your project like this:
```js
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, user, responseMode, 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.