-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from SpellcraftAI/dev
fix: large requests stalling, cleanup hanging
- Loading branch information
Showing
4 changed files
with
29 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "oaib" | ||
version = "1.0.0" | ||
version = "1.0.1" | ||
requires-python = ">=3.9" | ||
description = "A Python library for making rate-limited, async batch requests to the OpenAI API." | ||
authors = [{ name = "CTJ Lewis", email = "[email protected]" }] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import oaib | ||
|
||
|
||
async def test_long(): | ||
batch = oaib.Auto() | ||
|
||
n = 20 | ||
m = 20 | ||
for i in range(n): | ||
await batch.add( | ||
"chat.completions.create", | ||
model="gpt-4", | ||
max_tokens=4000, | ||
messages=[{"role": "user", "content": "say hello and goodbye " * m}] | ||
) | ||
|
||
chats = await batch.run() | ||
assert len( | ||
chats) == n, f"Chat batch should return {n} results, got {len(chats)}" | ||
|
||
chat = chats.iloc[0].get("result") | ||
assert chat['choices'], "Should get valid chat completions" | ||
|
||
chats |