mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-14 00:47:27 +00:00
Close dataframe column names are being treated as one by the LLM (#3611)
We are sending sample dataframe to LLM with df.head(). If the column names are close by, LLM treats two columns names as one, returning incorrect results.  In the above case the LLM uses **Org Week** as the column name instead of **Week** if asked about a specific week. Returning head() as a markdown separates out the columns names and thus using correct column name. 
This commit is contained in:
parent
860fa59cd3
commit
568c4f0d81
@ -35,7 +35,7 @@ def create_pandas_dataframe_agent(
|
||||
prompt = ZeroShotAgent.create_prompt(
|
||||
tools, prefix=prefix, suffix=suffix, input_variables=input_variables
|
||||
)
|
||||
partial_prompt = prompt.partial(df=str(df.head()))
|
||||
partial_prompt = prompt.partial(df=str(df.head().to_markdown()))
|
||||
llm_chain = LLMChain(
|
||||
llm=llm,
|
||||
prompt=partial_prompt,
|
||||
|
Loading…
Reference in New Issue
Block a user