Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(forum-auto-response): Implement forum auto response #7766

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

Jonaspng
Copy link

@Jonaspng Jonaspng commented Jan 23, 2025

Feature: Forum Auto Response

Overview

Implemented forum auto-response functionality with the following key features:

Changes

  • Auto-responds only to the first question in a forum topic
  • Adds "Generate Reply" button for manual reply generation
  • Configurable settings in Ragwise component settings page
    image

Setup Note

In order for the text chunking ability to work you need to have 2 things:

  1. OpenAI API Key in env file
  2. pgvector extension installed in psql

Limitations

  • RAG currently supports only PDF and TXT materials

TODO

  • Test cases

@Jonaspng Jonaspng force-pushed the jonas/forum-auto-reponse branch 3 times, most recently from e207722 to 961d3be Compare January 24, 2025 15:16
- pgvector for psql to support vector storage and operations
- neigbor for code easier db migrations including vectors
- langchainrb and ruby-openai for LLM services
- pdf-reader for reading text from pdff
- openai api key is not complete
@Jonaspng Jonaspng force-pushed the jonas/forum-auto-reponse branch 2 times, most recently from de6b2b5 to d67f021 Compare January 26, 2025 13:23
@Jonaspng Jonaspng marked this pull request as ready for review January 27, 2025 08:21
@Jonaspng Jonaspng force-pushed the jonas/forum-auto-reponse branch 6 times, most recently from 60afe6e to aa0ee8a Compare February 3, 2025 09:18
- initialise LLM models that will be used in code
- LANGCHAIN_OPENAI model is used for normal RAG operations
- RAGAS (Retrieval Augmented Generation Assessment) model is used for evaluation of RAG
- add course_material_text_chunks which belongs to course_materials
- add course_material_text_chunkings which belongs to course_materials and trackable_jobs
- add workflow_state column to course_materials table.
- add text_chunk model to represent segments of material after chunking, including content and associated embeddings
- add text_chunking model to represent trackable text_chunking jobs
- trackable job that tracks text chunking of course material
- add create_text_chunks that create text chunks from material
- add destory_text_chunks that destroy materials's text chunks
- modify update so that if the file contents was updated (i.e new file upload) it will destroy current text chunks related to previous material
- modify destroy to ensure that material cannot be deleted while material is still undergoing text chunk job
- only course owner or manager will be allowed to manage text chunks
- add workflow state to material model
- material has_many text_chunks and has_one text_chunking
- add chunking service that handles the chunking of text and file
- add llm service that handles services provided by llm which are text embedding and getting image caption
- update material view to include workflow state
- update folder and subfolder permission view to include canManageKnowledgeBase
- create_text_chunks handle creation of text_chunks
- destroy text_chunks handle deletion of text_chunks
- switch that create or destroy course material text chunks
Integrate new backend API changes by updating the UI components and related files:
- Updated `store.ts` to handle new state management for the backend changes
- Modified `operations.ts` to incorporate new API calls
- Adjusted types in `types.ts` to reflect backend schema changes
- Updated React components to work with the updated state and API logic
- add course_material_text_chunk_references table
- update course_material_text_chunks table
- update psql image to allow for pgvector
- create course_forum_rag_auto_answerings table to keep track of auto answering jobs
- add is_ai_generated, original_text and scores columns to course_discussion_posts
- rag_workflow_service handles response generation
- response_evaluation_service evaluates quality of generated response using faithfulness and answer_relevance scores
- auto_answering controller logic is located in auto_answering_concern
- reply will only be automatically generated for first post in forum topic
- non course manager/owner will not be able to see drafted post
- identity of automated response will be the course creator
- identity of manually requested AI response will be the manger/owner that clicks the publish/mark as answer and publish button
- add generate reply button allows for manual request of draft AI generated responses
- add mark as answer and publish button that marks and publish draft AI generated responses
- add publish button that publish draft AI generated responses
- only course manager and course owner can see draft AI generated responses and generate reply button
@Jonaspng Jonaspng force-pushed the jonas/forum-auto-reponse branch from e39d846 to d4c1a7b Compare February 5, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant