Questions tagged [langchain-js]

12 questions
7
votes
0 answers

How to combine ConversationalRetrievalQAChain, Agents, and Tools in LangChain

I'd like to combine a ConversationalRetrievalQAChain with - for example - the SerpAPI tool in LangChain. I'm using ConversationalRetrievalQAChain to search through product PDFs that have been ingested using OpenAI's embedding API and a local Chroma…
Johannes Fahrenkrug
  • 42,912
  • 19
  • 126
  • 165
1
vote
0 answers

Installing node-faiss & libomp when deploying

I'm building AI website with Chagpt API & langchain. all using node.js, express now when I want to deploy the project on any platform, like vercel or renderjs I get this error telling me that faiss-node library is not installed and I need to…
HamzaElkotb
  • 138
  • 1
  • 7
1
vote
0 answers

UnstructuredURLLoader is not avalaible in langchain in javascript

Due to this issue I have to use cherrio, html-to-text which is given in documentation , there are some cons of this. When I asked RetrivalQA then It return css properties, URLs and javascript as well , because they are involved init. Can please some…
1
vote
0 answers

Always getting "undefined" for the source document

I'm using langchainJS with openAI for my local documents, and I wrote the below code, the source of the answer I get is always undefined: import { OpenAI } from "langchain/llms/openai"; import { ConversationalRetrievalQAChain } from…
Hasan A Yousef
  • 22,789
  • 24
  • 132
  • 203
0
votes
0 answers

Undefined error when passing async function as function parameter

I am trying to use RecursiveCharacterTextSplitter with length function as 3rd party tokenizer. As per documentation RecursiveCharacterTextSplitter accepts lengthFunction as promise also but I am hitting TypeError: Cannot convert undefined to a…
0
votes
0 answers

Langchain RetrievalQAChain providing the correct answer despite of 0 docs returned from the vector database

I thought RetrievalQAChain will only reply based on the documents returned from the database. My prompt explicitly says, don't reply if you don't know the answer. 0 documents were returned from my vector database and I hopping it would say I don't…
Anni
  • 77
  • 7
0
votes
1 answer

What is the difference between 'SQLDatabaseChain' and 'create_sql_agent' in langchain?

I'm creating a feature that uses 'LangChain' to turn user input questions into SQL. I know that 'create_sql_agent' has logic to fix any errors in the query answered by 'openai'. Is 'SQLDatabaseChain' not error correcting? If so, can using…
ykoo
  • 209
  • 2
  • 9
0
votes
1 answer

How do I solve working around "Models maximum content length exceeded" errors

I am using LangChain and OpenAI to interract with my postgres database. It works well on small databases. But when the database is larger (say over 10K rows), I get the following error This model's maximum context length is 4097 tokens. However,…
steve landiss
  • 1,833
  • 3
  • 19
  • 30
0
votes
1 answer

BufferMemory issue with ConversationalRetrievalQAChain in JavaScript/Nodejs

I am using Langchain in Nodejs and following the official documentation to save the conversation context using ConversationalRetrievalQAChain and BufferMemory, and not able to pass the memory object to ConversationalRetrievalQAChain.fromLLM as per…
Wajeeh Aslam
  • 94
  • 1
  • 8
0
votes
0 answers

LangChain custom Toolkit from a couple of Tools

How can I combine a bunch of LangChain Tools into a Toolkit in TypeScript? import { Toolkit } from 'langchain/agents'; import { DynamicTool, Tool } from 'langchain/tools'; export class CustomToolkit extends Toolkit { tools: Tool[]; …
Joost Döbken
  • 3,450
  • 2
  • 35
  • 79
0
votes
0 answers

Streaming a response w/LangChain in Javascript

I am writing a little app in javascript utilizing the LangChain library. I have the following snippet: /* LangChain Imports */ import { OpenAI } from "langchain/llms/openai"; import { BufferMemory } from "langchain/memory"; import {…
Alan
  • 1,067
  • 1
  • 23
  • 37
0
votes
0 answers

How to set the system tone and use a template in LangChainJS?

I am playing around with the LangChain JavaScript library and wanted to make sure I am doing this correctly. My goals is to set the tone of the AI (who they are) and then pass in some context and let it ask a question about that context. So this is…