How can I use Refine and MapReduce summarisation with multiple variables?

103 views Asked by At

I need to make summary based on sql table structure. I have a path to table, columns and columns description. I use langchain but I have errors.

I always get error:

ValidationError: 1 validation error for RefineDocumentsChain
__root__
  document_variable_name text was not found in llm_chain input_variables: ['table_path', 'table_structure'] (type=value_error)
  • prompt_template contains variables table_path and table_structure*.

refine_prompt right now isn't so important.

prompt = PromptTemplate(
    input_variables=['table_path', 'table_structure'],
    template=prompt_template
)

refine_prompt = PromptTemplate.from_template(refine_template)

refine chain:

model = 'gpt-4'
llm = ChatOpenAI(temperature=0.7, model=model)

refine_chain = load_summarize_chain(
    llm,
    chain_type='refine',
    question_prompt=prompt,
    refine_prompt=refine_prompt,
    return_intermediate_steps=True,
    input_key=['table_path']
)

I always get an error. What should I do?

0

There are 0 answers