- Notifications
You must be signed in to change notification settings - Fork108
Mirascope/mirascope
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Welcome to Mirascope, which allows you to use any frontier LLM with one unified interface.
Install Mirascope:
uv add"mirascope[all]"frommirascopeimportllm@llm.call("anthropic/claude-sonnet-4-5")defrecommend_book(genre:str):returnf"Recommend a{genre} book."response=recommend_book("fantasy")print(response.text())
frompydanticimportBaseModelfrommirascopeimportllmclassBook(BaseModel):title:strauthor:str@llm.call("anthropic/claude-sonnet-4-5",format=Book)defrecommend_book(genre:str):returnf"Recommend a{genre} book."book=recommend_book("fantasy").parse()print(f"{book.title} by{book.author}")
frompydanticimportBaseModelfrommirascopeimportllmclassBook(BaseModel):title:strauthor:str@llm.tooldefget_available_books(genre:str)->list[Book]:"""Get available books in the library by genre."""return [Book(title="The Name of the Wind",author="Patrick Rothfuss")]@llm.call("anthropic/claude-sonnet-4-5",tools=[get_available_books],format=Book)deflibrarian(request:str):returnf"You are a librarian. Help the user:{request}"response=librarian("I want a fantasy book")whileresponse.tool_calls:response=response.resume(response.execute_tools())book=response.parse()print(f"Recommending:{book.title} by{book.author}")
For streaming, async, multi-turn conversations, and more, see thefull documentation.
This project is structured as a monorepo, that conceptually divides into four parts:
python/contains the Python implementation, and examples (inpython/examples)typescript/contains the Typescript implementation, and examples (intypescript/examples)cloud/contains the full-stack cloud application (React frontend + Cloudflare Workers backend)docs/contains the unified cross-language documentation (indocs/content), as well as configuration needed to build the docs
For detailed information about the codebase structure, architecture, and design decisions, seeSTRUCTURE.md.
Usebun run cloud:dev to launch the dev server.
Note thatBun must be installed.
We currently have four CI jobs:
- codespell: Checks for common misspellings including python, typescript, and docs repos
- python-lint: Linting and typechecking for Python code
- typescript-lint: Linting and typechecking for Typescript code
- cloudflare docs build: Builds and previews the documentation site
You can runbun run ci in the root directory to run all CI checks locally. If adding new checks to GitHub CI, please also add it to the ci script in rootpackage.json as well.
Mirascope uses Semantic Versioning.
This repository uses a multi-license structure:
- Default: All code is licensed under theMIT License unless otherwise specified.
- Cloud Directory: The
cloud/directory is licensed under a proprietary license. Seecloud/LICENSEfor details.
Subdirectories may contain their own LICENSE files that take precedence for files within those directories.
About
The LLM Anti-Framework
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.