L6 Agents - Sorting results divergences

Same code as the video, different result.
Not very robust!

There’s a number of errors I’ve encountered throughout this course in the python workbooks, and while most of them have been nutted out by the students I don’t think that’s a solid learning process. Getting divergent results like this does not inspire confidence in the tools.
Just my 2 yen.

Entering new AgentExecutor chain…
I can use the sorted() function to sort the list of customers. I will need to provide a key function that specifies the sorting order based on last name and then first name.
Action: Python REPL
Action Input:

customers = [['Harrison', 'Chase'], ['Lang', 'Chain'], ['Dolly', 'Too'], ['Elle', 'Elem'], ['Geoff', 'Fusion'], ['Trance', 'Former'], ['Jen', 'Ayai']]
sorted_customers = sorted(customers, key=lambda x: (x[1], x[0]))
sorted_customers

Observation:
Thought:The customers have been sorted by last name and then first name.
Final Answer: [[‘Jen’, ‘Ayai’], [‘Harrison’, ‘Chase’], [‘Lang’, ‘Chain’], [‘Elle’, ‘Elem’], [‘Geoff’, ‘Fusion’], [‘Trance’, ‘Former’], [‘Dolly’, ‘Too’]]

Finished chain.

“[[‘Jen’, ‘Ayai’], [‘Harrison’, ‘Chase’], [‘Lang’, ‘Chain’], [‘Elle’, ‘Elem’], [‘Geoff’, ‘Fusion’], [‘Trance’, ‘Former’], [‘Dolly’, ‘Too’]]”

Debug:


[llm/end] [1:chain:AgentExecutor > 5:chain:LLMChain > 6:llm:ChatOpenAI] [1.38s] Exiting LLM run with output:
{
“generations”: [
[
{
“text”: “The customers have been sorted by last name and then first name.\nFinal Answer: [[‘Jen’, ‘Ayai’], [‘Harrison’, ‘Chase’], [‘Lang’, ‘Chain’], [‘Elle’, ‘Elem’], [‘Geoff’, ‘Fusion’], [‘Trance’, ‘Former’], [‘Dolly’, ‘Too’]]”,
“generation_info”: null,
“message”: {
“content”: “The customers have been sorted by last name and then first name.\nFinal Answer: [[‘Jen’, ‘Ayai’], [‘Harrison’, ‘Chase’], [‘Lang’, ‘Chain’], [‘Elle’, ‘Elem’], [‘Geoff’, ‘Fusion’], [‘Trance’, ‘Former’], [‘Dolly’, ‘Too’]]”,
“additional_kwargs”: {},
“example”: false
}

Great to have the debug, but knowing where the issue lies is only half the debug solution, you have to know how to fix it and there’s no guidance on that. Debugging is a critical part of programming, and would be great to see even more info on how to debug AND fix these complex process chains.