Neura AI
  • What is Neura?
    • Releases
      • Neura Artifacto UI v0.2.0 - Revolutionizing User Experience with Image Previews, Image Analysis, and
      • Neura AI v0.5.98 - Artifacto UI Updates, FLUX Pro Ultra & Telegram Formatting and Major System Up
      • Neura AI v0.5.97 - Llama 3.3 70b Versatile and Llama 3.3 70b SpecDec Integrations and Azure Blob
      • Neura AI v0.5.96 Dash Tracking, Telegram Hyperlinks and Get User Ids Improvements
      • Neura AI v0.5.95 - Core System Stability & Integration Improvements
      • Neura AI v0.5.9 - ReDeAct Agents' Action Handling and Decision-Making Optimization
      • Neura AI v0.5.8 - Faster, Smoother, More Reliable
      • Neura AI v0.5.7 Core Request-Response Handling Architecture Optimization
      • Neura AI v0.5.6 - Security Update and Bugs Fix
      • Neura AI v0.5.5 - Security Optimizations, Bugs Patches and Multi-Language Support, Flux 1.1 Pro
      • Neura AI v0.5.4 Optimized Relevant Context Retrieval, Eleven Labs Speech to Text and Enhanced Trello
      • Neura AI v0.5.3 - Telegram Text, Code and Image Format Enhancement - TTS and Upload Fallback Added
      • Neura AI v0.5.2 - Trello Integration, Llama3.1 Improvements, and Parallel API Call Strategy
      • Neura AI v0.5.1 - React Agents Bug Fix, Introducing Top Context To Fetch and Context Optimizations
      • Neura AI v0.5.0: Introducing Lexicon. Our Enhanced NLP Engine For Analysis and Classification
      • Neura AI v0.4.9 Bug Fixes, Sales Bot Optimizations and Context Improvements
      • Neura AI v0.4.8 - Improved User Interface and History Handling
      • Neura AI v0.4.7 - Context Management and Environment Optimizations
      • Neura AI v0.4.6 - Context Optimization and Chat History Metadata to Analysis
      • Neura AI v0.4.5: Enhanced RAG System and Improved Content Retrieval
      • Neura AI v0.4.4 - New Features: Docker Alerts and Sales Bot
      • Neura AI v0.4.3 - Slack Integration
      • Neura AI v0.4.2 - Enhanced Context Management and Group Collaboration
      • Neura AI v0.4.1 - Document Handling, Logging, and System Reliability
      • Neura AI v0.4.0: Introducing Reason-Act Agents, Multi Module Retry Logic and Real-Time Error Alerts
      • Neura AI v0.3.9: Voice Interaction Revolution
      • Neura AI v0.3.8 - Llama 3.1 Integration, Rust Migration, Speech-to-Text, 781 commits and more!
      • Neura AI v0.3.7 - Telegram Integration Features: Track Negative Feedback, and Intelligent Alerts
      • Neura AI v0.3.6 - Image-to-Video and Remove Background Feature
      • Neura AI v0.3.5 - In-painting and Search and Replace Image Processing
      • Neura AI v0.3.4 - Advanced RAG Context Management and Multi-Model Image Generation
      • Neura AI v0.3.3 - Store Data to Database | Optimized Entry Point Response and Discord New Triggers
      • Neura AI v0.3.2 - Improved Context Management and NLP Integration to Purge Context
      • Neura AI v0.3.1 - Enhanced Context and Response Time, Task Determination, Groq and Claude 3.5 Sonnet
      • Neura AI v0.3.0 Update: Chat History RAG, NLP Enhancements, and Multi-Language Image Processing
      • Neura AI v0.2.9 - Feedback and Sentiment Mechanism for Telegram Groups
      • Neura AI v0.2.8 - Telegram Integration - Text Formatting Enhancements
      • Neura AI v0.2.7 - Enhanced Analysis Process, 16_ID, Image Upload Processing, Token Usage Tracking
      • Neura AI v0.2.6 - GPT4o Integration, Enhanced API, URL Sanitizer, Additional Logging and Bugs Fixed
      • Neura AI v0.2.5 - Advanced API Rate Limiting and Exponential Backoff Integration
      • Neura AI v0.2.4 - Image Upload Handling, Generation Module and LLM Interaction Enhanced
      • Neura AI v0.2.3 - Bug Fix: Azure Blob Upload Bug Resolved
      • Neura AI - Enhanced AI-Driven Interaction Capabilities
      • Neura AI v0.2.1 - Updating Asynchronous Architecture, RAG Cosine
      • Neura AI v0.2.0 - Modularization of the API Endpoint, Bug fixes, and Azure Blob Migration
      • Neura AI v0.1.92 Improved Database Retrieval and Response Performance
      • Neura AI v0.1.91 - API v1.1 - Interact Endpoint Enhanced - Support For Multipart/Form-Data
      • Neura AI v0.1.9 - RAG Similarity | Initial Query Triggers Added | FE Improvements
      • Neura AI v0.1.8 - Image Generation Enhanced, New NLP Triggers, Additional Modularization
      • Neura AI v0.1.7 Image Analysis Improvement, Mint NFT Button Improvement, and Additional Triggers Ad
      • Neura AI 0.1.6 - Frontend Update, Integration of Additional NLP Triggers and STT
      • Neura AI v0.1.5 | NLP for image generation, dynamic styling for dark or light mode and more
      • Neura v0.1.4 | Img previews, API CORS+OPTIONS, user-icon added, generate images with user query+URL
      • Neura AI v0.1.3 | Successful Resolution of Socket.IO Issues and Frontend Modularization
      • Neura AI v0.1.2 | Integration of Multiple Endpoints with FastAPI and Httpx
      • Neura AI v0.1.1 | BE Architecture and FastAPI Migration
      • WIP -> Upload Button Integration
    • Scope and Goals
    • Modular Architecture
    • Context and Database (RAG)
    • Integrations
      • Telegram Oracle v0.1.0
        • Fana Telegram Oracle Agent v0.2.0 - Revamped Doc Update
        • Fana Telegram Oracle Agent v0.3.0
      • Trello
      • Discord
      • Slack
    • Applications
      • Neura Artifacto User Interface v0.3.0
      • Neura Autonomous Agents
      • Neura Transcribe (TSB)
      • Neura AI Insight Forge - Your WebGenius Scraper and FAQ Engine v0.2.0
      • Neura Email Sales Agent (ESA)
        • Neura Email Oracle Agent v0.1.1 - Enhancements to Self-Loop Email Handling and OOF Filters
    • API
    • Software Development Kits (SDK)
      • Rust
      • Typescript
    • Security and Authentication
    • Upcoming Features and Product Roadmap
    • Getting Started - Read.me
    • Project Diagram and Structure
Powered by GitBook
On this page
  • What's new?
  • Key Features and Improvements
  • 1. Advanced Chat History RAG For Contextual Conversations
  • 2. NLP and Trigger Word Enhancements
  • 3. Enhanced Image Processing
  • 4. Multi-Language Support
  • Conclusion
  1. What is Neura?
  2. Releases

Neura AI v0.3.0 Update: Chat History RAG, NLP Enhancements, and Multi-Language Image Processing


What's new?

This update introduces significant enhancements to the FANA LLM system, focusing on chat history retrieval-augmented generation (RAG) for contextual conversations, natural language processing (NLP) for image generation and analysis, and improved multi-language support. Key improvements include better relevance in past interactions, more accurate context retrieval, and enhanced regex NLP trigger word and phrases detection for image generation and analysis.

Key Features and Improvements

1. Advanced Chat History RAG For Contextual Conversations

Retrieval-augmented generation (RAG) is an advanced natural language processing (NLP) technique that combines the strengths of retrieval-based and generative-based AI models. RAG leverages the vast pre-existing knowledge embedded within AI models and enhances it by retrieving relevant information to generate unique, context-aware responses. This approach allows RAG AI to deliver highly accurate results by not only summarizing the retrieved data but also synthesizing it into coherent and human-like language.

Purpose:

  • Finds the most relevant past interactions based on semantic similarity and keyword relevance.

  • Ensures context-aware responses by utilizing previous chat history effectively.

Use Case:

  • Ideal for tasks like image modifications or follow-up requests where understanding the context of previous user interactions is crucial.

Challenges Solved:

  1. AI Context Limitation:

    • Traditional models like GPT-3.5 have a 4k token limit for input and output. RAG overcomes this by retrieving only the most relevant parts of the chat history, ensuring that the input stays within token limits.

  2. Cost Efficiency:

    • Processing entire chat histories for each request can be computationally expensive. By retrieving only the relevant data, RAG significantly reduces the number of tokens processed, saving costs on API usage.

  3. Enhanced Relevance:

    • Combines semantic similarity with keyword relevance to ensure the retrieved data is not just similar but also contextually relevant to the user’s current query.

  4. Improved User Experience:

    • Provides more accurate and context-aware responses, enhancing the overall interaction quality and user satisfaction.

Highlights:

  • Cosine Similarity: Calculates the cosine similarity between user input embedding and stored embeddings to find semantically similar content.

  • Keyword Relevance: Extracts and matches keywords between user input and stored chat history to ensure contextual relevance.

  • Combined Scoring: Uses a weighted approach to combine similarity and keyword relevance scores, ensuring the most relevant content is retrieved.

Function: find_most_similar_chat history

# Extract keywords from user input
user_keywords = extract_keywords(user_input)
logging.info(f"Extracted user keywords: {user_keywords}")

# Calculate keyword relevance scores
keyword_relevance_scores = []
for entry in supabase_data:
    entry_text = " ".join([msg["content"] for msg in entry["chat_history"]["data"]])
    entry_keywords = extract_keywords(entry_text)
    common_keywords = user_keywords.intersection(entry_keywords)
    keyword_relevance_scores.append(len(common_keywords))

# Normalize keyword relevance scores
max_keyword_score = max(keyword_relevance_scores) if keyword_relevance_scores else 1
normalized_keyword_scores = [score / max_keyword_score for score in keyword_relevance_scores]

# Combine similarity and keyword relevance
combined_scores = [(sim * 0.7) + (kw_score * 0.3) for sim, kw_score in zip(similarities, normalized_keyword_scores)]

if not combined_scores:  # Check if the list is empty
    logging.info("No valid similarities found.")
    return "No similar content found due to invalid data"

max_combined_score = max(combined_scores)
similarity_threshold = 0.25  # Adjusted similarity threshold for chat history. The higher the more similar it should be.

2. NLP and Trigger Word Enhancements

Function: check_for_trigger_words

  • Purpose: Improved detection of trigger words and questions to handle more complex inputs.

  • Use Case: Detects if user inputs should trigger image generation or other actions.

  • Highlights:

    • Uses refined regex patterns to detect questions and trigger words.

    • Translates non-English inputs to English before processing.

    translated_input = await translate_with_gpt(client, user_input, "English")
    is_question = any(re.search(pattern, user_input_lower) for pattern in question_patterns)

3. Enhanced Image Processing

Function: analyze_and_generate

  • Purpose: Processes image-related queries considering the context of previous interactions.

  • Use Case: Ensures relevant image modifications and follow-up actions are based on past interactions.

  • Highlights:

    • Extracts the last generated image description from chat history.

    • Combines user input with previous image context for analysis.

    last_image_description = msg["content"].split("Here's the image created based on your request:")[1].strip()
    combined_input = f"{user_input} {last_image_description} {' '.join([msg['content'] for msg in retrieved_history])}"

4. Multi-Language Support

Functions: translate_to_english, translate_back_to_user

  • Purpose: Handles multi-language inputs and outputs by translating non-English inputs to English and back from English to the target Language.

  • Use Case: Ensures non-English inputs are accurately processed and trigger appropriate actions.

  • Highlights:

    • Translates user input to English before processing.

    translated_text = response.choices[0].message["content"].strip()
    user_input_lower = translated_input.lower()

Conclusion

The v0.3.0 update to FANA LLM brings significant enhancements in retrieving and utilizing past interactions, improving response relevance and accuracy, and supporting multi-language inputs. These improvements ensure a more effective and user-friendly experience, paving the way for more sophisticated interactions and better support for user queries in the future.


PreviousNeura AI v0.3.1 - Enhanced Context and Response Time, Task Determination, Groq and Claude 3.5 SonnetNextNeura AI v0.2.9 - Feedback and Sentiment Mechanism for Telegram Groups

Last updated 10 months ago