MaartenGr / MaartenGr/BERTopic

Enabling AsyncOpenai client

Open
#1,761 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.8k
Forks
920
Avg merge
22h 24m
Merged PRs (30d)
5

Description

Hi @MaartenGr!

As far as I know, the package does not support the [async OpenAI client](https://github.com/openai/openai-python?tab=readme-ov-file#async-usage) for generating fine-tuned topic representations. Having the option to generate these representations concurrently would greatly speed up this part of the pipeline.

Implementation-wise, we could check whether the client is synchronous (`openai.OpenAI`) or asynchronous (`openai.AsyncOpenAI`) and then having slightly different subroutines for both clients. Main thing would be to run `asyncio.gather` for the async subroutine to allow concurrent requests.

What are your thoughts on this?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the code that generates fine-tuned topic representations and the current synchronous OpenAI client usage. Review the linked OpenAI async-usage documentation, then determine how both synchronous and asynchronous clients should be supported; done means asynchronous requests can run concurrently without removing synchronous support.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.