comet-ml / opik

Open-source end-to-end LLM Development Platform
Apache License 2.0
1.35k stars 73 forks source link

[OPIK-99] Implement batching for spans creation #298

Open alexkuzmik opened 1 week ago

alexkuzmik commented 1 week ago

Details

Added batching for CREATE-SPAN requests. Batches are flushed to the streamer queue automatically every second or whenever accumulated message items reach max batch size limit (at the moment - 1000 items).

Batching works only inside the SDK, if someone tries to do the following

import opik
client = opik.Opik()

... batching will not work for that client (and all clients derived from it).

Under the hood of the SDK we instantiate Opik client like that

client = opik.Opik(_use_batching=True)

Issues

Resolves the issue when SDK sends a lot of CREATE-SPAN requests to the backend independetly, loading it and utilizing more network resources. Backend should be less loaded,

Testing

Added unit tests. E2E tests also pass, but this PR requires extra QA.

Documentation

-