Agentic Systems

LLMs

Flows we know

1. GPT-Wrapper


prompt = f"""
Write me a campaign plan for my product :${super_toothpaste}
"""

answer = llm.predict(prompt)

2. RAG

user_query = input("Enter your question")

similar_chunks = vector_db.retrieve(user_query, k=4)

prompt = f"""You are a question answering agent.
Here is some context:

{json.dumps(similar_chunk)}

Based on the above, answer the question: {user_query}"""

answer = llm.predict(prompt)

Limitations

  1. You always have to perform Vector search

  1. Handling Multiple retrievers.

  1. Error prone : No validation

https://medium.com/pinterest-engineering/how-we-built-text-to-sql-at-pinterest-30bad30dabff

4. Very limited functionality

Escalating my chat to human

Cancel my order


4. Quality of response is limited

  • Cannot solve Complex tasks
  • Has Reasoning issues

(system 1 v/s system2 thinking)

Transformers architecture

Improving stuff

  1. You always have to perform Vector search

  2. Handling Multiple retrievers

Still another problem: Vague user query inputs

alt text

Combine with multiple retrievers

Now also add looping 🙂

Complexity ++

  1. Error prone : No validation
answer = llm.predict(prmopt)

validation_prompt = f"Based on the question {question}, this was the answer given:
{answer}.
Is this corerct? if not fix it."

final_answer = llm.predict(validation_prompt)
answer = llm.predict(prmopt)

data, error = execute_sql(answer)

if error:
    validation_prompt = f"""Based on the question {question},
    this was the sql generated. {answer}.
    Got this error on running it: {error}.
    Write corrected sql.
    """

    final_answer = llm.predict(validation_prompt)

    execute_sql(final_answer)
  1. Complex task / Reasoning issues

Pause

Emergence

Reasoning + Acting = ReAct

Agents

Why?

  • Use LLMs as reasoning engines
  • Non-deterministic sequence of actions

Improving Quality

Gpt3.5 with agentic workflow outperforms Gpt4

Q: Duh, Can't I just resuse the same LLM with a different prompt?

Some characterestics

  • Iterative
  • Tool Usage
  • Reasoning
  • Automated Action

Multi Agent Systems

Image Optimizer Demo

https://youtu.be/C94pTaKoLbU?si=5e8XntCK0gV43KYv&t=2040

Main Potential usecases

  • For Complex problems(Not necessariliy difficult ones)
  • When the steps are not pre-determined

Conclusion

Referneces

Thank You!

@aldrinjenson

aldrinjenson.com


This presentation was built using Free Software!

start with current workflow

look at the problems

see how agents can solve them

look at their limitations

# what do we already know

---

large language models

chatGPT is not an LLM

gpt3.5 is

claude2 is an llm

evi is not

in llm, you take in text and you get text output

even if i say hello, you still do RAG

How to decide and choose

Oky for just text to sql

can only give input and output

customer service agent. how to escalate to human

![w:600](image-1.png)

![w:800](image-14.png)

![w:900](image-4.png)