Adding OpenAI wrapper class to notdiamond.toolkit.openai. [ENG-1107]#28
Conversation
|
Still working on async tests, please hold! |
|
Async tests done, please feel free to review. |
|
This this good as far as what it is meant to do. But I wonder if we might have set the wrong objective. If I look at what this user's comment says, I think what they want to do is use the from notdiamond.toolkit.openai import OpenAI
client = OpenAI() # assume that API keys are set in the envvar (both ND api key and the LLM provider keys)
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content": "Say this is a test",
}
],
model="openai/gpt-3.5-turbo, togetherai/Meta-Llama-3.1-8B-Instruct-Turbo",
)What do you think? |
We cannot necessarily assume I didn't take the user's feedback as a hard requirement, since I personally don't love the |
Ok that's fair. We can make this client exclusively route between openai models and expand if we get user request. In that case I would say let's make the |
|
Tests seem to be failing but might have to do with the staging API key? |
r0ymanesco
left a comment
There was a problem hiding this comment.
This looks good! I'm approving but noting that the tests are failing because of the ND api keys not working. Do these tests run against the staging instance or the prod instance?
|
TogetherAI test is failing, otherwise fine. Will merge this. |
This PR creates sync and async OpenAI client wrappers for Not Diamond, allowing users to introduce ND-based routing to their code with one tiny change:
Tests are mostly designed to ensure functionality for the encapsulated OpenAI classes remains as expected.