Assuming the API key was properly defined, what change does the Generative AI Engineer need to make to fix their chain? | Databricks Certified Generative AI Engineer - Associate Quiz - LeetQuiz

Explanation:

Explanation

Option A is correct because it properly uses the LLMChain with the PromptTemplate object and passes the input variable "funny" to the generate() method. This is the standard way to use LangChain's LLMChain:

  1. PromptTemplate is created with input variables and template
  2. LLMChain is initialized with the prompt template
  3. generate() method is called with the input values for the template variables

Option B is incorrect because:

  • It tries to format the prompt template before passing it to LLMChain (prompt.format("funny"))
  • This would result in a formatted string instead of a PromptTemplate object
  • The generate() method is then called without any arguments, but LLMChain expects input values

In LangChain, the correct pattern is to pass the PromptTemplate object to LLMChain and then provide the input variables when calling generate() or invoke() methods.

Powered ByGPT-5.2

Comments

Loading comments...