Repository navigation
Update Azure endpoint integration and refactor for GitHub models in bia-bob repository. - #238
github-actions[bot] wants to merge 7 commits into
Conversation
|
The parameters of the new prompt_azure function and the code in the new prompt_azure function are incomplete. Extend it with the functionality from git-bob implement this |
…parameters with those from `src/bia_bob/endpoints/_openai.py`.
|
This message was generated by git-bob (version: 0.21.0, model: gpt-4o-2024-08-06, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully. In response to the issue discussions for GitHub issues #236 and #237, the Azure endpoint integration was refined by moving the existing functionality from
During solving this task, the following errors occurred:
|
|
Hi @sebi06 , would you mind trying this branch out and check if it works with your azure setup? You can install it after cloning with Let me know if it works! Best, |
|
I tried the branch but I still get errors (while using AzureOpenAI interface still works fine) . When I run the cell client2 = OpenAI(base_url=os.environ["AZURE_OPENAI_ENDPOINT"],
api_key=os.environ["AZURE_OPENAI_API_KEY"])
print("\n".join([model.id for model in client2.models.list().data]))I get the following errors: |
|
Would you mind building in a print statement in this line to print out |
|
I added this: ...
if image is None: # normal text-based prompt
system_message = [{"role": "system", "content": system_prompt}]
# init client
if Context.client is None or not isinstance(
Context.client, AzureOpenAI
):
# debugging
print(f"Model init kwargs: {model_init_kwargs}")
Context.client = AzureOpenAI(**model_init_kwargs)
client = Context.client
...but this line is never hit. No print and also when I set a breakpoint ist does not stop when executing: import os
from openai import AzureOpenAI, OpenAI
from bia_bob import bob
bob.initialize(
endpoint="https://zdp-gpt-dev-sdc-oai-001.openai.azure.com",
api_key=os.environ.get("AZURE_API_KEY"),
model="gpt-4o",
)
client1 = AzureOpenAI(
api_version=os.environ["AZURE_OPENAI_API_VERSION"],
azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
api_key=os.environ["AZURE_OPENAI_API_KEY"],
)
print("\n".join([model.id for model in client1.models.list().data]))
client2 = OpenAI(
base_url=os.environ["AZURE_OPENAI_ENDPOINT"],
api_key=os.environ["AZURE_OPENAI_API_KEY"],
)
print("\n".join([model.id for model in client2.models.list().data])) |
|
After |
|
I tried again inside a jupyter notebook but nothings printed out. But I get the error: |
This message was generated by git-bob (version: 0.21.0, model: gpt-4o-2024-08-06, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully.
This pull request addresses issue #237 (and also closes #236) by updating the structure of the Azure endpoint implementation in the bia-bob repository. The previous Azure integration was moved from
src/bia_bob/endpoints/_azure.pyinto a new filesrc/bia_bob/endpoints/_github_models.py, allowing for a dedicated function namedprompt_github_models. Theprompt_azurefunction was then implemented insrc/bia_bob/endpoints/_azure.pyto tailor it for Azure's needs using AzureOpenAI. Additionally, thegenerate_responsefunction insrc/bia_bob/_utilities.pywas updated to include a new if-block for handlinggithub_modelsendpoints, ensuring better configuration and adaptability for different models.src/bia_bob/endpoints/_github_models.py The existing Azure code was moved to this new file and renamed to align with GitHub model functionality.
src/bia_bob/endpoints/_azure.py Implemented the
prompt_azurefunction to handle Azure-specific API initialization.src/bia_bob/_utilities.py Updated the
generate_responsefunction to manage both Azure and GitHub model endpoints.closes #237