Hazina Quick Start: From Zero to AI Call in 5 Minutes
Hazina Framework

Hazina Quick Start: From Zero to AI Call in 5 Minutes

Let’s skip the theory and get our hands dirty. In this post, you’ll go from a blank terminal to a working AI call in under 5 minutes.

Prerequisites

Requirement Version Check
.NET SDK 9.0+ dotnet --version
Git Any git --version
API Key OpenAI or Anthropic Your dashboard

Step 1: Clone the Repository

git clone https://github.com/martiendejong/Hazina.git
cd hazina

Step 2: Restore Dependencies

dotnet restore Hazina.QuickStart.sln

Step 3: Set Your API Key

# PowerShell
$env:OPENAI_API_KEY = "sk-your-key-here"

# Or for Anthropic
$env:ANTHROPIC_API_KEY = "sk-ant-your-key-here"

Step 4: Run the Demo

dotnet run --project apps/Demos/Hazina.Demo.ConfigurationShowcase

You should see output showing various AI providers responding to prompts. That’s it – Hazina is running.

Step 5: Your First Custom AI Call

Create a new console app or add this to any existing project:

using Hazina.AI.FluentAPI.Configuration;
using Hazina.AI.FluentAPI.Core;

// One-time setup
QuickSetup.SetupOpenAI(Environment.GetEnvironmentVariable("OPENAI_API_KEY")!);

// Ask anything
var answer = await Hazina.AskAsync("What is the meaning of life?");
Console.WriteLine(answer);

Two lines of setup. One line to call AI. That’s the Hazina way.

Verification Checklist

Component Command Expected
Build dotnet build Hazina.QuickStart.sln 0 errors
Tests dotnet test Hazina.QuickStart.sln All pass
Demo dotnet run --project apps/Demos/... AI output

Common Scenarios

Just exploring? Open Hazina.QuickStart.sln and browse the demos.

Building an AI app? Reference Hazina.AI.FluentAPI in your project and use QuickSetup.

Need document search? We’ll cover RAG in a later post – stay tuned.

In the next post, we’ll dive into the FluentAPI – Hazina’s elegant way of talking to any LLM provider.

Frequently Asked Questions

How do I clone the Hazina repository?

To clone the Hazina repository, open your terminal and run the command `git clone https://github.com/martiendejong/Hazina.git`. After cloning, navigate into the directory with `cd hazina` to start working on your AI call.

What are the prerequisites for running Hazina?

You need the .NET SDK version 9.0 or higher and Git installed on your system. Additionally, you must have an API key from either OpenAI or Anthropic to authenticate your AI calls.

How do I set my OpenAI API key in Hazina?

You can set your OpenAI API key in a PowerShell terminal by using the command `$env:OPENAI_API_KEY = ‘sk-your-key-here’`. Replace ‘sk-your-key-here’ with your actual API key to ensure proper authentication.

What is the purpose of the Hazina.Demo.ConfigurationShowcase?

The `Hazina.Demo.ConfigurationShowcase` demonstrates how various AI providers respond to prompts. Running the command `dotnet run –project apps/Demos/Hazina.Demo.ConfigurationShowcase` will showcase the output and help you verify that Hazina is set up correctly.

Terug naar overzicht

Frequently Asked Questions

What version of the .NET SDK is required to use Hazina? +

You need .NET SDK version 9.0 or higher to use Hazina. You can check your version by running the command 'dotnet --version' in your terminal.

How do I set my API key for OpenAI or Anthropic in Hazina? +

You can set your API key using PowerShell with the command '$env:OPENAI_API_KEY = "sk-your-key-here"' for OpenAI and '$env:ANTHROPIC_API_KEY = "sk-ant-your-key-here"' for Anthropic.

What command do I use to run the demo application in Hazina? +

You can run the demo application by executing the command 'dotnet run --project apps/Demos/Hazina.Demo.ConfigurationShowcase' in your terminal.

What is the purpose of the QuickSetup class in Hazina? +

The QuickSetup class is used for one-time setup to initialize the OpenAI API key, allowing you to easily make AI calls with just a couple of lines of code.

Where can I find demonstrations and explore the functionalities of Hazina? +

You can explore the demos by opening the Hazina.QuickStart.sln file and browsing through the available examples provided in the project.

ENNL