Questions tagged [py-langchain]

LangChain is an open-source framework for developing applications powered by language models. Use this tag for the python-specific package.

LangChain is an open-source framework for developing applications powered by language models. Use this tag for the python-specific package.

Official Python LangChain documentation: https://python.langchain.com/en/latest/

153 questions
1
vote
1 answer

how can i print the output of my langchain agent easily?

I've created a simple agent using Langchain and I just want to print out the last bit, is there an easy way to do this. (I mean everything that comes after AI); Test code from langchain.agents import Tool import os from langchain.agents import…
1
vote
2 answers

LangChain Zero Shot React Agent uses memory or not?

I'm experimenting with LangChain's AgentType.CHAT_ZERO_SHOT_REACT agent. By its name I'd assume this is an agent intended for chat use and I've given it memory but it doesn't seem able to access its memory. What else do I need to do so that this…
BBrooklyn
  • 350
  • 1
  • 3
  • 15
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

Langchain AgentExecutor Won't Use Any Tools

I'm using the tiiuae/falcon-40b-instruct off HF, and I am trying to incorporate it with LangChain ReAct. I'm using a regular LLMChain with a StringPromptTemplate that's just the standard Thought/Action/Action Input/Observation prompt with some few…
linw
  • 11
  • 2
1
vote
0 answers

How to Set Role of the System Help - OpenAI API + Langchain

Hi I'm working on a project to create a conversation agent to help with critical literacy using OpenAI's API. I want the model (currently using gpt-3.5-turbo) to call from data stored in a directory, which is where I'm using modules from langchain.…
1
vote
1 answer

Can not import ApifyWrapper from langchain.utilities to make web scrapping

I can not import ApifyWrapper from langchain.utilities. I need to import it to make web scrapping from a web site for a school project. I got this error: ** ImportError Traceback (most recent call last) Cell In1, line…
Darlyn LC
  • 11
  • 3
1
vote
1 answer

SQLDatabaseChain with GPT-4 returns SQL syntax error

I wrote a program trying to query local sqlite db, and it worked fine for text-davinci-003: llm = OpenAI(model_name="text-davinci-003", verbose=True) However, after I changed it to GPT-4: llm = ChatOpenAI(model_name="gpt-4-0613",…
TaihouKai
  • 133
  • 11
1
vote
0 answers

Make LangChain agent output also Retrieval's info

I am working on creating a langchain agent logging.info("Initializing the tools") tools = [ StructuredTool.from_function(some_func), Tool( name="QA", func=(lambda message:…
Carlo
  • 11
  • 2
1
vote
0 answers

Calling OpenAI via LangChain taking long time and failing

Please help me with this issue. I've been trying for the last few days to solve it without any success. I am calling the LLM via LangChain: calling openai via Langchain response = llm.call_as_llm(f"{qdocs} Question: Please list all your shirts with…
1
vote
1 answer

How can I force ConversationalRetrievalChain to retrieve more information from the vector db? (langchain)

I loaded a company organization chart to a csv and loaded into FAISS. Each time I ask the bot to list out all the duties of an individual, it only searches up to 4 results and create the response based on that. How do I force it to pull more data…
ImiHuman
  • 63
  • 6
1
vote
1 answer

How to add memory to load_qa_chain or How to implement ConversationalRetrievalChain with custom prompt with multiple inputs

I am trying to provide a custom prompt for doing Q&A in langchain. I wasn't able to do that with ConversationalRetrievalChain as it was not allowing for multiple custom inputs in custom prompt. Hence, I used load_qa_chain but with load_qa_chain, I…
Jason
  • 676
  • 1
  • 12
  • 34
1
vote
1 answer

Adding large chunks of text after embedding into pinecone without openai ratelimit in langchain

I am using langchain to read data from a pdf and convert it into a chunks of text. I then embed the data into vectors and load it into a vector store using pinecone. I am getting a maxretry error. I guess I am loading all the chunks at once which…
slaveCoder
  • 519
  • 2
  • 17
  • 46
1
vote
2 answers

AttributeError: 'tuple' object has no attribute 'run' when using LangChain LLMChain

I'm building my first langchain app by following https://www.youtube.com/watch?v=MlK6SIjcjE8&t=189s Here's my code: #bring in deps import os from apikey import apikey import streamlit as st from langchain import LLMChain, OpenAI,…
ImiHuman
  • 63
  • 6
1
vote
0 answers

How to optimize the building time with LlamaIndex by storing an agent or a toolkit?

I'm currently building a chatbot agent with llama_index to take benefit of a dataset of 13 000 documents I have. However, making the toolkit to then build the agent takes a lot of time (4h) because I have to load the indexes to make the actual…
1
vote
4 answers

Unable to read text data file using TextLoader from langchain.document_loaders library because of encoding issue

I am new to Langchain and I am stuck at an issue. My end goal is to read the contents of a file and create a vectorstore of my data which I can query later. from langchain.embeddings.openai import OpenAIEmbeddings from langchain.text_splitter import…
Rito
  • 3,092
  • 2
  • 27
  • 40
1 2
3
10 11