I need to use Azure OpenAI Gpt-4o-mini API for my crewai agents, I am struggling with errors only and I can;t find Documentation

import os
from crewai import Agent, Task, Crew, Process
from langchain_openai import ChatOpenAI
from dotenv import load_dotenv

load_dotenv()

azure_endpoint = os.getenv('AZURE_OPENAI_ENDPOINT')  # e.g., "https://<your-resource-name>.openai.azure.com/"
azure_key = os.getenv('AZURE_OPENAI_API_KEY')  # Your API key
azure_version = os.getenv('OPENAI_API_VERSION')  # Use a supported API version
azure_model = os.getenv('AZURE_OPENAI_DEPLOYMENT')  # e.g., "gpt-4"

llm = ChatOpenAI(
    model=azure_model,
    api_version=azure_version,
    api_key=azure_key,
    # azure_endpoint=open_ai_base,    
    base_url=azure_endpoint,    
)


# Create agents
web_scraper_agent = Agent(
    role='India Data Retrieval Agent',
    goal='Gather comprehensive data about India from the web.',
    backstory='''You are an expert in web scraping and data collection. Your job is to retrieve 
                relevant information about India, including its demographics, economy, 
                culture, recent news, and geopolitical stance.''',
    verbose=True,
    llm=llm
)

# Define tasks
web_scraper_task = Task(
    description='Scrape and compile all relevant data about India from various sources.',
    expected_output='A structured dataset containing information about India’s demographics, economy, culture, and news.',
    agent=web_scraper_agent,
    output_file='data.txt'
)


# Assemble a crew
crew = Crew(
    agents=[web_scraper_agent],
    tasks=[web_scraper_task],
    verbose=True,   
)

# Execute tasks
result = crew.kickoff()
print(result)

with open('results.txt', 'w') as f:
    f.write(result)

Help me with any Documentation. Thank you

@tonykipkemboi Please help me with this, how to use Azure OpenAI API with Crewai

have you tried this:

from crewai import LLM
import get_settings


class LLMConfig:
    @staticmethod
    def default_llm() -> LLM:
        settings = get_settings()
        model = settings.AZURE_MODEL_NAME
        api_key = settings.AZURE_API_KEY
        base_url = settings.AZURE_API_BASE
        return LLM(
                model=model,
                api_key=api_key,
                base_url=base_url
            )

Here model_name should have a prefix - ‘azure/’

AZURE_MODEL_NAME="azure/gpt-4o-2024-08-06"