This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi LinkedIn friend! | |
Here is how I managed to have the agent I'm building reduce token usage. | |
1. My agent has 62 tools (and growing quickly in terms of number of tools..) | |
2. Each tool has a description. All in all I was sending the entire 62 tools+description in every agent turn. | |
It came out to 10k tokens before even the system prompt+user prompt - ON EVERY TURN. | |
The solution I found was to do a preflight LLM request to select only the relevant tools for the user request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import pytest | |
from langchain.agents import initialize_agent, AgentType | |
from langchain.agents.agent import AgentExecutor | |
from langchain.tools import Tool | |
from langchain_community.llms import OpenAI | |
from langchain.prompts import PromptTemplate | |
from langgraph.prebuilt import create_react_agent | |
# Agno imports | |
from agno.agent.agent import Agent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.net.*; | |
import java.util.*; | |
import java.util.Map.Entry; | |
public class CourseRegister implements Runnable { | |
boolean debug = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Yo all the users that Yo'ed your Yo service ("subscribers"): | |
curl --data "api_token=<token>" http://api.justyo.co/yoall/ | |
--------------------------------------------------------------------- | |
Specific user Yo: | |
curl --data "api_token=<token>&username=<username>" http://api.justyo.co/yo/ |