Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial version #228

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

initial version #228

wants to merge 2 commits into from

Conversation

benlower
Copy link
Contributor

i want to refactor this to use the fixie SDK after it supports list agent conversations.

i want to refactor this to use the fixie SDK after it supports list agent conversations.
Copy link
Contributor

@mdwelsh mdwelsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for now, run this by @petersalas though

const response = await axios({
method: 'get',
maxBodyLength: Infinity,
url: `https://api.fixie.ai/api/v1/agents/${agentId}/conversations`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this endpoint paginated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it is. changed the implementation to handle paging.

numTokens += encoded.length;

numConvoChars += message.response.length;
numConvoTokens += encoded.length;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ignores the quadratic effect where messages become input tokens to subsequent generations (e.g. a conversation with 10 messages uses >> 10 times the number of input tokens as a conversation with 1 message)

But old messages also get pruned as well as they fill up the context window, so calculating it accurately is even trickier. The easiest thing to get approximately correct is to calculate the number of output tokens, because that's just the assistant text/functionCall messages, but I'm guessing you want an estimate for both :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants