@e-llm-studio/data-engine
v1.3.0
Published
data operations library for e-llm-studio
Downloads
319
Keywords
Readme
eLLM Studio Data Operations Package
Welcome to the eLLM Studio Data Operations package! 🎉 This package enables streaming chat functionality with your AI assistant in eLLM Studio via WebSocket and GraphQL. It's designed for both frontend and backend implementations.
🚀 Features
- Data Ingestion: Ingest text data.
📦 Installation
npm i @e-llm-studio/data-engine
🛠️ Data Ingestion
Here’s how you can use the startChatStream function to set up the AI chat stream:
import { ContentManager } from "@e-llm-studio/data-engine";
// Example usage:
const baseUrl = "https://dev-egpt.techo.camp";
const chatbotId = "3e94587c-733d-4e92-8d98-d5150c63b8cd";
const chatbotName = "Assistant1";
const organizationName = "techolution";
const username = "your-username";
const password = "your-password";
const contentManager = new ContentManager(
baseUrl,
chatbotId,
chatbotName,
organizationName,
username,
password
);
// Save text content example
contentManager
.saveTextContent("Title1", "Text Content")
.then((saveResponse) => {
console.log("Save Response:", saveResponse);
})
.catch((error) => {
console.error("Save Error:", error);
});
// Delete text content example
contentManager
.deleteTextContent(["671a391fbcce6ddc80e86099"])
.then((deleteResponse) => {
console.log("Delete Response:", deleteResponse);
})
.catch((error) => {
console.error("Delete Error:", error);
});
// Get Context Id
contentManager
.getContextId("6d25ddb4-e375-4adf-a98d-4d14114c2840")
.then((contextResponse) => {
console.log("Context Response:", contextResponse);
})
.catch((error) => {
console.error("Context Error:", error);
});
// Seamantic Search api
contentManager
.getSemanticSearch(
"model-name", // AI Model to use for semantic search
"search query", // The query string for searching
"request123", // Unique request ID for tracking
"user456", // User ID performing the search
0, // Offset for pagination
10 // Limit for pagination
)
.then((searchResponse) => {
console.log("Search Response:", searchResponse);
})
.catch((error) => {
console.error("Search Error:", error);
});
📝 API Documentation saveTextContent(title: string, textContent: string): Promise Saves the provided text content under the specified title.
Parameters: title (string): The title of the text content. textContent (string): The content text to be saved.
deleteTextContent(contextInfoIds: string[]): Promise Deletes the specified content using the provided array of contextInfoIds.
Parameters: contextInfoIds (string[]): An array of IDs representing the content items to delete. deleteContextId(fileId: string): Promise Deletes a specific content item by its fileId.
Parameters: fileId (string): The ID of the content item to delete from the chatbot’s context. 🔐 Authentication The package requires user authentication. The ContentManager class will automatically log in using the provided credentials and manage access tokens internally.
Semantic Search The getSemanticSearch method performs a semantic search based on a provided query and model, returning results from the chatbot’s knowledge base.
Parameters:
aiModel (string): The name of the AI model to use for the search. searchQuery (string): The search query string. requestId (string): A unique identifier for tracking the search request. userId (string): The ID of the user initiating the search. offset (number): The number of results to skip (for pagination). limit (number): The maximum number of results to return. Returns: A promise that resolves with search results matching the query or an error message if the search fails.
👥 Community & Support
For any questions or issues, feel free to reach out via our GitHub repository or join our community chat! We’re here to help. 😊