Skip to content

Conversation

@Nunu27
Copy link
Contributor

@Nunu27 Nunu27 commented May 25, 2025

Description

When using this library, i notice that the LLM sometime answer to the previous message although it have been answered before. After debugging, i found out that the last message from the LLM before the new query is deleted, and after looking through the code, before sending the conversation history to the LLM, it call slice method to remove the last item on the history, and it remove the LLM last message.

This was discovered independently and doesn't relate to any opened issues.

Type of change

Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I simply log the messages on the prepare method of the BaseModel class before returning, and do a simple query with this code.

import { RAGApplicationBuilder, SIMPLE_MODELS } from "@llm-tools/embedjs";
import { LibSqlStore } from "@llm-tools/embedjs-libsql";
import { OpenAiEmbeddings } from "@llm-tools/embedjs-openai";

const ragApplication = await new RAGApplicationBuilder()
	.setModel(SIMPLE_MODELS.OPENAI_GPT4_O)
	.setEmbeddingModel(new OpenAiEmbeddings())
	.setStore(new LibSqlStore({ path: "./db" }))
	.build();

await ragApplication.query("What is the net worth of Elon Musk today?");
await ragApplication.query("What about Jeff Bezos?");

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new tsc or eslint warnings
  • I have ran tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings
  • My changes do not result in new npm audit errors

@nx-cloud
Copy link

nx-cloud bot commented Jun 13, 2025

View your CI Pipeline Execution ↗ for commit 95856f9.

Command Status Duration Result
nx run-many --t=build ✅ Succeeded 43s View ↗

☁️ Nx Cloud last updated this comment at 2025-06-13 11:15:41 UTC

@adhityan adhityan merged commit e27fac6 into llm-tools:main Jun 13, 2025
4 checks passed
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.

2 participants