our friendly logo that looks like a hashbrown character from an animated tv showhashbrown

Microsoft Azure

First, install the Microsoft Azure adapter package:

npm install @hashbrownai/azure

Usage

Currently, our Azure adapter only supports text streaming:

import { Chat } from '@hashbrownai/core';
import { HashbrownAzure } from '@hashbrownai/azure';

app.post('/chat', async (req, res) => {
  const request = req.body as Chat.CompletionCreateParams;
  const stream = HashbrownAzure.stream.text({
    apiKey: AZURE_API_KEY,
    endpoint: AZURE_ENDPOINT,
    request,
  });

  res.header('Content-Type', 'application/octet-stream');

  for await (const chunk of stream) {
    res.write(chunk);
  }

  res.end();
});

Let's break this down:

  • HashbrownAzure.stream.text is a function that takes an API key, an endpoint, and a Hashbrown request object, and returns an async iterable stream of encoded data ready to be sent to your frontend.
  • req.body is the request object that contains the parameters for the chat completion.
  • res.header sets the response header to application/octet-stream, which is required for streaming binary data to your app.
  • res.write writes each chunk to the response as it arrives.
  • res.end closes the response when the stream is finished.

Model Versions

Azure requires model versions to be supplied when making a request. To do this, specify the model version in the model string when supplied to any resource:

completionResource({
  model: 'gpt-4o@2025-01-01-preview',
  // ...
});
Microsoft Azure Usage Model Versions

LiveLoveApp provides secure, compliant, and reliable long-term support to enterprises. We are a group of engineers who are passionate about open source.

Enterprise Support

AI Engineering Sprint

Get your team up-to-speed on AI engineering with a one week AI engineering sprint. Includes a workshop on AI engineering with hashbrown and a few days with the hashbrown developer team to bring your AI ideas to life.

Long Term Support

Keep your hashbrown deployments running at peak performance with our Long Term Support. Includes an ongoing support retainer for direct access to the hashbrown developer team, SLA-backed issue resolution, and guided upgrades.

Consulting

LiveLoveApp provides hands-on engagement with our AI engineers for architecture reviews, custom integrations, proof-of-concept builds, performance tuning, and expert guidance on best practices.