Giter Club home page Giter Club logo

oaib's People

Contributors

ctjlewis avatar jvmncs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

oaib's Issues

larger chat requests cause errors

hi, tried this out today and found that both Batch and Auto aren't functioning properly for chat requests with longer messages. here's an adapted example from the existing Auto test:

import oaib

import pytest


@pytest.mark.asyncio
async def test_auto():
    batch = oaib.Auto()

    n = 20
    m = 20
    for i in range(n):
        await batch.add("chat.completions.create", model="gpt-4", messages=[{"role": "user", "content": "say hello " * m}])

    chats = await batch.run()
    assert len(chats) == n, f"Chat batch should return {n} results, got {len(chats)}"
    print(chats)

    chat = chats.iloc[0].get("result")
    assert chat['choices'], "Should get valid chat completions"

for m~=20, this test gets pretty flaky. in practice I was trying to use it with messages of >1000 tokens, which fails more reliably

Is it possible to chain calls with oaib?

Really cool tool, but is it possible to chain calls. I.e. batch a first call, process the result and then add a second call to the batch to act on the result?

I saw that there are callbacks, but not sure if that can be used to do this in a clean way.

Azure support: `Auto`

Rate limit headers don't behave exactly the same as OpenAI's API, no time to add right now, good first PR or will get to it later.

From Azure:

    MAIN | 2024-03-02 13:35:10 | HEADERS | {'cache-control': 'no-cache, must-revalidate', 'content-length': '831', 'content-type': 'application/json', 'access-control-allow-origin': '*', 'apim-request-id': 'bb943c68-99ed-46ab-bda9-a5efbdf5897a', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'x-content-type-options': 'nosniff', 'x-ms-region': 'North Central US', 'x-ratelimit-remaining-requests': '79', 'x-ratelimit-remaining-tokens': '61353', 'x-accel-buffering': 'no', 'x-request-id': '3a8b1a44-a02c-4a07-b51d-1c88acec4c4f', 'x-ms-client-request-id': 'bb943c68-99ed-46ab-bda9-a5efbdf5897a', 'azureml-model-session': 'd008-20240215231538', 'date': 'Sat, 02 Mar 2024 21:35:09 GMT'}

Seems wholly reliant on x-ratelimit-remaining-requests, where the library relies on OpenAI's x-ratelimit-limit-tokens headers, since their remaining-requests and remaining-tokens values are cached for long periods and do not update.

Is order preserved?

Hi, thanks for the library, it's very useful! I am just wondering, if the order of the completions is guaranteed to be preserved (i.e., in the same order as the added prompts)? Or would I need to use the metadata dict to pass some id?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.