Replies: 6 comments 1 reply
-
🤖 Hi there, Thanks for reaching out and for your interest in using LangChain with the Mistral 7B Instruct model. I see that you're trying to use the Firstly, the from langchain.llms import CTransformers
import pandas as pd
# Initialize the dataframe
df = pd.DataFrame({
'column1': ['data1', 'data2', 'data3'],
'column2': ['data4', 'data5', 'data6']
})
# Initialize the CTransformers instance
llm = CTransformers(
model='TheBloke/Mistral-7B-Instruct-v0.1-GGUF',
model_file="mistral-7b-instruct-v0.1.Q4_K_M.gguf",
config={'max_new_tokens': 1024, 'temperature': 0}
)
# Query the dataframe
for index, row in df.iterrows():
prompt = f"Process the data: {row['column1']}, {row['column2']}"
result = llm.generate(prompt)
print(result) In this example, the Please note that the way you construct the prompt would depend on the specific task you want the model to perform. Also, please note that the I hope this helps! If you have any other questions or run into any issues, feel free to ask. Best, SourcesThis response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
Did you solve this? I'm stuck at a similar problem |
Beta Was this translation helpful? Give feedback.
-
Trying to recreate. What's your parser? |
Beta Was this translation helpful? Give feedback.
-
@ianuvrat have you solve the issue? |
Beta Was this translation helpful? Give feedback.
-
Yes
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Akash A Desai ***@***.***>
Sent: Monday, January 22, 2024 5:57:14 PM
To: langchain-ai/langchain ***@***.***>
Cc: ianuvrat ***@***.***>; Mention ***@***.***>
Subject: Re: [langchain-ai/langchain] Need help in Langchain Custom Agent with Local LLM (Open Source) to query pandas dataframe. (Discussion #11429)
@ianuvrat<https://github.com/ianuvrat> have you solve the issue?
—
Reply to this email directly, view it on GitHub<#11429 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AQPPCDTCEW3ZHV3KIPEDEZDYPZLKFAVCNFSM6AAAAAA5UEULNGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DEMBXHE4DS>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi @ianuvrat, I am stuck on a similar issue. Can you please post the revised and refined working code with comments here? |
Beta Was this translation helpful? Give feedback.
-
Hi guys, after successfully trying out langchain pandas' agents with Open AI, my next aim is to use open source LLM to query database. So far I'm able to integrate Mistral 7B Instruct model with langchain , but I 'm not able to get final answer.
Initialize LLM
Reading df
Initializing tool (df as a tool)
prefix = f'You are friendly HR assistant. You are tasked to assist the current user: {user} on questions related to HR. You have access to the following tools: '
initialize the LLM agent
When I print the template of agent here is is what I get:
print(agent.agent.llm_chain.prompt.template)
Result
Now when run the agent ,
This is what I get as answer:
I see Mistral do a modest attempt to query, but then stops there to fetch the result. Can someone please assist here. Here is my code. (I'm using Google Colab GPU free tier and quanitsed LLM model)
Beta Was this translation helpful? Give feedback.
All reactions