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

Reduce size of swarms : Tick token using torch #705

Open
jmikedupont2 opened this issue Dec 26, 2024 · 8 comments
Open

Reduce size of swarms : Tick token using torch #705

jmikedupont2 opened this issue Dec 26, 2024 · 8 comments
Assignees

Comments

@jmikedupont2
Copy link

We currently seem to have a dependency in the api server on the ticktoken that uses torch,
this adds many gbs into the docker image. Can we please remove or refactor that?

@kyegomez
Copy link
Owner

@jmikedupont2 this will be difficult because we need to cound the tokens the agents uses.

@kyegomez
Copy link
Owner

kyegomez commented Dec 26, 2024

@jmikedupont2 solution i can think of is : setup a tiktoken api that counts the number of tokens in each request and returns the number of tokens. But this will take some time. How much is it adding to the server?

@kyegomez
Copy link
Owner

@jmikedupont2 i'm removing 2 more packages to slim down the size ;)

@jmikedupont2
Copy link
Author

what if we move the token count to a separate litellm proxy server?
and that would hide the openai secrets from the agents, it could be more secure.

@kyegomez
Copy link
Owner

kyegomez commented Dec 31, 2024

oken count to a separate litellm proxy server?
and that would hide the openai secrets from the agents, it could be more secure.

that could work well, would we need an api for it?

@evelynmitchell
Copy link
Contributor

A litellm proxy server would run in the same environment as the swarms api server, and would wrap the incoming and outgoing api calls to the swarms api server.

user -> request -> litellm server supabase(user_usage += len(request)) -> swarms api call -> litellm server supabase(user_usage += len(answer)) -> answer -> user

The instructions to set up litellm are at: https://docs.litellm.ai/docs/proxy/deploy

@jmikedupont2
Copy link
Author

https://github.com/jmikedupont2/openlightllm I have a fork of litellm that I would like to continue working on that removes all the non-open source mess.

@jmikedupont2
Copy link
Author

I might have some terraform for that as well somewhere

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

No branches or pull requests

3 participants