Skip to content

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