Revised Helper Function
Direct Model Invocation:
The LiteLLMModel instance is likely callable. Instead of using a .complete() method, call the model directly with the prompt:
Response Handling:
The returned result might be a string or a dictionary. Check the type of result and extract the text accordingly. If your specific model returns responses in a different format, adjust the helper function to handle that format.
Consistency:
Update all parts of your code where you previously used .complete() to use the new call_llm function or a direct call to llm.
Helper Function (call_llm): Introduced to handle responses from LiteLLMModel.complete(), ensuring that text is extracted correctly.
Sanity Checker & Answer Expander: Updated to use call_llm instead of direct model calls to avoid type errors.
Other Calls to LLM: Replaced direct calls like llm(prompt) within handle_query and other blending scenarios with call_llm(prompt).
General Adjustments: Ensured consistency in handling model responses throughout the code.