Open
Description
Can LLMChain objects be stored and iterated over?
llms = [{'name': 'OpenAI', 'model': OpenAI(temperature=0)},
{'name': 'Flan', 'model': HuggingFaceHub(repo_id="google/flan-t5-xl", model_kwargs={"temperature": 1e-10})}]
for llm_dict in llms:
llm_name = llm_dict['name']
llm_model = llm_dict['model']
chain = LLMChain(llm=llm_model, prompt=prompt)
The first LLM model runs well, but for the second iteration, gives following error:
chain = LLMChain(llm=llm_model, prompt=prompt)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "pydantic\main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for LLMChain
prompt
value is not a valid dict (type=type_error.dict)
Am I missing something? in dictionary declarations?
More details at https://stackoverflow.com/questions/76110329/iterating-over-llm-models-does-not-work-in-langchain
Metadata
Metadata
Assignees
Labels
No labels