kyegomez / swarms

The Enterprise-Grade Production-Ready Multi-Agent Orchestration Framework Join our Community: https://discord.com/servers/agora-999382051935506503
https://docs.swarms.world
GNU Affero General Public License v3.0
1.79k stars 245 forks source link

[BUG] Unable to import AzureOpenAI #602

Closed techthiyanes closed 1 month ago

techthiyanes commented 1 month ago

Describe the bug Unable to import AzureOpenAI

To Reproduce Import AzureOpenAI from swarms

Expected behavior Should be able to import AzureOpenAI

Upvote & Fund

Fund with Polar

github-actions[bot] commented 1 month ago

Hello there, thank you for opening an Issue ! 🙏🏻 The team was notified and they will get back to you asap.

kyegomez commented 1 month ago

@techthiyanes try the swarm_models package. all of the models have been moved here

$ pip3 install -U swarm_models

Documentation is here

import os
from dotenv import load_dotenv
from swarms import AzureOpenAI

# Load the environment variables
load_dotenv()

# Create an instance of the AzureOpenAI class
model = AzureOpenAI(
    azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"),
    deployment_name=os.getenv("AZURE_OPENAI_DEPLOYMENT"),
    openai_api_version=os.getenv("OPENAI_API_VERSION"),
    openai_api_key=os.getenv("AZURE_OPENAI_API_KEY"),
    azure_ad_token=os.getenv("AZURE_OPENAI_AD_TOKEN"),
)

# Define the prompt
prompt = (
    "Analyze this load document and assess it for any risks and"
    " create a table in markdown format."
)

# Generate a response
response = model(prompt)
print(response)
techthiyanes commented 1 month ago

Thank you so much on your response. I am able to import it now.