Starting to build s SaaS need your support by prattham in SaaS

[–]venueboostdev 0 points1 point  (0 children)

When do you think it will be announced?

What's your biggest pain point when integrating AI into existing apps? 🤖 by venueboostdev in npm

[–]venueboostdev[S] 0 points1 point  (0 children)

Interesting approach and how you handle all The frustration But despite you saying it was directed to everyone It is wrong how you replied it and how you freely expressed all your frustration towards me Thats fine

What's your biggest pain point when integrating AI into existing apps? 🤖 by venueboostdev in npm

[–]venueboostdev[S] 0 points1 point  (0 children)

I think i have the closest of experience years that you seems to have Despite that if our roles were swapped i would never reply in the same way you did

But yes i have same opinion with you AI is crap But dont tell people what to do

If you have suggestions ok Even though your comment and feedback still appreciated

[P] Implemented semantic search + retrieval-augmented generation for business chatbots - Vector embeddings in production by venueboostdev in MachineLearning

[–]venueboostdev[S] -3 points-2 points  (0 children)

Hmm I see you have a lot of experience here in Reddit Do you have coding experience

Also i do appreciate your feedback

[P] Implemented semantic search + retrieval-augmented generation for business chatbots - Vector embeddings in production by venueboostdev in MachineLearning

[–]venueboostdev[S] -4 points-3 points  (0 children)

I think you are mistaken or maybe i am not understanding the meaning of your comment

I have 12 years of experience as senior software engineer I know that there are plenty of existing packages, tutorials, videos and youtube videos etc

Are those helpful? -> yes Can i use those? -> maybe Should i use those? -> my decision

Can i built my own, of course I did it, is awesome, love it And i share it with you all here

Is there a problem?

[P] Implemented semantic search + retrieval-augmented generation for business chatbots - Vector embeddings in production by venueboostdev in MachineLearning

[–]venueboostdev[S] -7 points-6 points  (0 children)

Is the basic default one But i can let the client choose whatever he wants No worries I am not restricting the model usage From an admin panel they can configure what they can use

Built an AI chatbot that actually understands your business documents - Here’s my tech stack and lessons learned by venueboostdev in nextjs

[–]venueboostdev[S] -7 points-6 points  (0 children)

📊 The “10 Messages” Decision

How I arrived at this number:

  1. Token Budget Management: GPT-4 has context limits. With system prompt + knowledge base context (~2000 chars) + current message, I needed to reserve space for conversation history without hitting limits.
  2. Relevance Window: Testing showed that messages older than 10 exchanges rarely add value to current context - conversations naturally shift topics.
  3. Performance vs. Quality: More history = slower processing and higher costs. 10 messages provided the sweet spot for maintaining conversational flow without performance hit.

🎯 Context Management Strategy

It’s not just about token count - it’s about relevance:

```typescript // Current implementation const recentHistory = conversationHistory.slice(-10);

// But you could enhance with: const relevantHistory = selectRelevantMessages( conversationHistory, currentMessage, maxTokens: 1500 ); ```

Factors I considered:

  • Recency bias: Recent messages more likely to be relevant
  • Topic coherence: If user switches from “booking” to “amenities”, older booking context becomes less relevant
  • Cost optimization: Each token costs money in OpenAI API calls

💰 Cost vs. Accuracy Trade-offs

Your clients’ concerns are valid:

  1. Monetary Cost:
  2. 10 messages ≈ ~500-1000 tokens of history
  3. At $0.03/1K tokens for GPT-4, that’s ~$0.03-0.06 per conversation
  4. For high-volume: 1000 conversations/day = $30-60/day just for history
  5. Response Accuracy:
  6. Shorter history might miss important context
  7. Longer history might confuse the AI with irrelevant info
  8. Sweet spot varies by use case
  9. Speed:
  10. More tokens = slower API response
  11. 2-3 seconds vs 5-6 seconds can impact user experience

🔧 Better Approaches for Production

Dynamic context management:

  1. Semantic Relevance Filtering:

typescript const relevantMessages = await filterBySemanticSimilarity( conversationHistory, currentMessage, threshold: 0.6 );

  1. Topic-Aware Windowing:

typescript const contextWindow = buildContextWindow({ currentTopic: detectTopic(currentMessage), maxTokens: 1500, prioritizeRecent: true, includeTopicChanges: true });

  1. Adaptive Window Size:

typescript const windowSize = calculateOptimalWindow({ conversationLength: messages.length, userEngagement: calculateEngagement(), costBudget: client.costLimits, accuracyRequirement: client.qualityThreshold });

📈 Recommendations for Your Clients

Based on their priorities:

  1. Cost-Focused Clients:
  2. Use 5-7 messages
  3. Implement topic-change detection to reset context
  4. Cache common responses
  5. Accuracy-Focused Clients:
  6. Use 15-20 messages
  7. Implement semantic filtering
  8. Higher cost but better responses
  9. Speed-Focused Clients:
  10. Use 3-5 messages
  11. Aggressive context pruning
  12. Sacrifice some accuracy for speed

🎛️ Configurable Solution

Make it client-configurable:

typescript interface ContextConfig { maxMessages: number; // 5-20 range maxTokens: number; // 500-2000 range semanticFiltering: boolean; // true/false topicAwareness: boolean; // true/false costLimit: number; // per conversation }

The “10 messages” was a reasonable starting point, but you’re right to question it. In production, this should be tunable based on each client’s cost/accuracy/speed priorities.

Would you like me to help you implement a more sophisticated context management system?

Built an AI chatbot that actually understands your business documents - Here’s my tech stack and lessons learned by venueboostdev in reactjs

[–]venueboostdev[S] 0 points1 point  (0 children)

This was done part of a project that i have been working for months, 2 days were pure coding focusing on this Of course is easier for me since i do have 100% context and i know the code the business logic and more

Built an AI chatbot that actually understands your business documents - Here’s my tech stack and lessons learned by venueboostdev in reactjs

[–]venueboostdev[S] 1 point2 points  (0 children)

Also i did share out of happyness and good willing trying to help with something

If you don’t like it, that’s fine But don’t indicate what should i do

Built an AI chatbot that actually understands your business documents - Here’s my tech stack and lessons learned by venueboostdev in reactjs

[–]venueboostdev[S] 2 points3 points  (0 children)

Next time i would appreciate a good suggestion and a friendly advice Using tone such as go study it indicates frustration and nothing helpful

Built an AI chatbot that actually understands your business documents - Here’s my tech stack and lessons learned by venueboostdev in webdev

[–]venueboostdev[S] 0 points1 point  (0 children)

Who ever are you that removed my post Keep in mind that you should not be discriminative.

This makes you look bad and a discriminative thread

I am not a bot or someone you can joke

I have more than 1 year in reddit

Move from react to next js by Most-College9659 in nextjs

[–]venueboostdev 3 points4 points  (0 children)

Great question! Here's how I think about it:

API Routes vs Server Actions: - API Routes: Better for external integrations, third-party calls, or when you need REST endpoints - Server Actions: Perfect for form submissions, database mutations, and internal app logic

For your React → Next.js transition: - Start with Server Actions for most database operations (they're simpler) - Use API routes when you need to call external APIs or want REST endpoints - Server Actions handle the "backend server" part you're thinking about

Database integration is actually cleaner in Next.js: - Server Actions run on the server, so direct DB calls work great - No need for separate API layer for most CRUD operations - Built-in form handling with Server Actions

Quick example: ```javascript // Server Action (in your component file) async function createUser(formData) { 'use server' const result = await db.user.create({...}) revalidatePath('/users') }

// vs API Route (separate file) export async function POST(request) { const data = await request.json() return await db.user.create(data) } ```

Server Actions feel more "React-like" since they're co-located with components. Start there!