Itequia

Azure OpenAI Services: Integrate AI into Your Apps

Abstract illustration with geometric shapes and digital landscape suggesting artificial intelligence and cloud services, placed next to the article title.

In the world of technology and application development, artificial intelligence (AI) is revolutionizing how we interact with software. Azure OpenAI Services emerges as a comprehensive solution for integrating AI into applications of any scale, offering a range of advanced machine learning and natural language processing services.

What is Azure OpenAI Services and How Does It Compare to OpenAI?

Azure OpenAI Services is a cloud-based AI platform that enables developers to easily integrate advanced machine learning and natural language processing capabilities into their applications. These services include language generation, natural language recognition, code generation, and much more, allowing developers to create smarter and more innovative applications.

A key difference with OpenAI is that with Azure OpenAI, customers get the security features of Microsoft Azure while running the same models as OpenAI.

  • Possibility of creating an instance in a specific regional zone.
  • Possibility of creating private networks.
  • Responsible AI content filtering.
Illustration of Microsoft Azure OpenAI with the OpenAI logo connected to icons representing security, language processing, coding, and customization features.

Models Available in Azure OpenAI Services

Azure OpenAI Services provides access via its REST API to powerful OpenAI language models, including GPT 3.5 Turbo, GPT 4, and GPT 4 with Vision (it is important to check the availability of models by regional zone, as currently GPT4 and GPT4 with Vision models are not available in Europe).

Tools Offered by Azure OpenAI Services

To make the most of Azure OpenAI Services, we will have available a REST API on a specific instance that we will need to create in our Microsoft Azure subscription.

This API has several versions, from the Legacy version (Completions), Chat Completion (the stable one), and Assistants, the latest one (still in beta), which allow us to exploit all the capabilities of the available models, with some differences.

Currently, in the stable version of the API (Chat Completion), we have the following tools:

  • Audio:
    • Create audio from text
    • Transcribe audio
    • Translate audio
  • Chat
    • Text generation
    • Conversation maintenance
  • Embeddings
    • Create text embeddings accessible by models and algorithms.
  • Fine-tuning
    • Creation of a model trained with specific data.
  • Files
    • Upload files to perform Fine-tuning (training data).
  • Images
    • Image generation from a given description.

As can be seen, this version offers tools for almost anything we can think of. But it has some limitations that have been addressed in the beta version of the new Assistants API.

Advantages and Disadvantages of the Chat Completion API

Ventajas 

  • Simplicity
  • Flexibility in integrating external data
  • Scalability
  • Lower overhead costs: requires fewer resources and administrative effort compared to the Assistants API.

Disadvantages

  • Limited context management: not as effective in managing extended contexts, which may be necessary for complex interactions.
  • Independent requests: each request is treated independently, which may not be ideal for applications requiring a deep understanding of previous interactions.
  • Potentially less effective for complex queries. 

The New API: Assistants

In the new version of the API (Assistants), we have the same functionalities as in the Chat Completion version. However, the process of making requests undergoes a complete change. In this new version, requests are no longer independent of each other. Rather, they become part of the same conversational thread linked to a specific Assistant. This implies a more complex configuration and management of the assistants, conversation threads, and the execution of requests made by the system integrating Azure OpenAI Services.

Below are the tools and concepts of the new Assistants version:

  • Assistants: Allows us to create as many assistants as we need, using the base model we require (GPT 3, 3.5, 4, etc.).
  • Threads: In this new version, we will have to create Threads to manage the messages we send to the model, and what the model responds to us.
  • Files
  • Messages
  • Runs

What advantages do we find in the new API?

  • Context management: The Assistants API stands out for maintaining context across multiple iterations, something crucial in scenarios where context plays an important role in generating relevant responses.
  • Customization: It offers more advanced customization options, allowing us to adapt the assistant’s behavior.
  • Persistent sessions: This new API effectively manages extended dialogue threads.
  • Handling complex queries: This new API adapts much better to complex requests, where it is necessary to have the entirety of the context or external information.

How to Get Started with Azure OpenAI Services?

To begin with Azure OpenAI Services, you just need to follow a few simple steps.

  1. Have a Microsoft Azure subscription
  2. Create the Azure OpenAI Services resource
  3. Select the geographical zone of our instance and assign it a name
  4. Deploy a model
  5. Obtain the API key for our instance
  6. Consume our REST API and make requests

Once we have completed the steps described above, we will be able to make the first requests to our instance and start exploiting the potential of AI models. It is also important to note that besides being able to make requests via HTTP to the REST API, the official libraries are also available:

  • Nuget package: Azure.AI.OpenAI (Chat Completion)
  • Nuget package: Azure.AI.OpenAI.Assistants (Assistants)

In Conclusion

In conclusion, when integrating with Azure OpenAI Services, you should consider both options. The decision of which version to use will depend on the needs and functional requirements of the project.

Interested in implementing Azure OpenAI Services in your project? Contact us for more information and personalized advice!

Agustín Plaza Alcántara – Lead Developer at Itequia
Azure OpenAI Services: Integrate AI into Your Apps - Itequia | Itequia AI Web