Introduction to Mirascope
Mirascope is an innovative and versatile library designed to facilitate working with Large Language Models (LLMs). By providing a unified interface, Mirascope simplifies interaction with various LLM providers. This enables users to seamlessly collaborate with platforms such as OpenAI, Anthropic, Mistral, Gemini, Groq, Cohere, LiteLLM, Azure AI, Vertex AI, and Bedrock.
Whether users are involved in text generation, information extraction, or developing AI-driven agents, Mirascope offers a suite of tools to streamline development and build powerful, adaptable applications.
30 Second Quickstart
Getting started with Mirascope is incredibly quick and straightforward. Users can install Mirascope for their desired LLM provider and set their API key by using the following commands:
pip install "mirascope[openai]"
export OPENAI_API_KEY=XXXXX
After installation, users can make their first call to an LLM to extract structured data from unstructured text. For example, to extract the title and author of a book:
from mirascope.core import openai
from pydantic import BaseModel
class Book(BaseModel):
title: str
author: str
@openai.call("gpt-4o-mini", response_model=Book)
def extract_book(text: str) -> str:
return f"Extract {text}"
book = extract_book("The Name of the Wind by Patrick Rothfuss")
assert isinstance(book, Book)
print(book)
# Output: title='The Name of the Wind' author='Patrick Rothfuss'
Tutorials
To help newcomers and seasoned developers alike, Mirascope offers a range of tutorials. The quickstart tutorial provides an interactive way to begin exploring Mirascope's capabilities, along with many other tutorials available on their platform.
Usage
For an in-depth exploration of all the features Mirascope offers, users can refer to the comprehensive Learn documentation. This resource provides detailed guidance on how to effectively utilize Mirascope in various projects.
Versioning
Mirascope adheres to Semantic Versioning, ensuring that version numbers convey precise information about updates and changes to the software.
Licence
Mirascope is distributed under the MIT License, allowing users to freely use, modify, and distribute the software within the scope of this permissive license.