MCPcopy Index your code
hub / github.com/ajndkr/lanarky

github.com/ajndkr/lanarky @v0.8.8

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.8.8 ↗ · + Follow
185 symbols 832 edges 36 files 92 documented · 50%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

lanarky-logo-light-mode lanarky-logo-dark-mode

The web framework for building LLM microservices.

Stars License Twitter

Python Coverage Version Stats

⚠️ Disclaimer: This project is now in maintenance mode. I won't be adding new features or actively maintaining the project as I have moved on to other projects and priorities. While I will address critical bugs and security issues as needed, active development has ceased from my end. I do encourage the community to continue to contribute to the project if they find it useful. Thank you for using lanarky!

Lanarky is a python (3.9+) web framework for developers who want to build microservices using LLMs. Here are some of its key features:

  • LLM-first: Unlike other web frameworks, lanarky is built specifically for LLM developers. It's unopinionated in terms of how you build your microservices and guarantees zero vendor lock-in with any LLM tooling frameworks or cloud providers
  • Fast & Modern: Built on top of FastAPI, lanarky offers all the FastAPI features you know and love. If you are new to FastAPI, visit fastapi.tiangolo.com to learn more
  • Streaming: Streaming is essential for many real-time LLM applications, like chatbots. Lanarky has got you covered with built-in streaming support over HTTP and WebSockets.
  • Open-source: Lanarky is open-source and free to use. Forever.

To learn more about lanarky and get started, you can find the full documentation on lanarky.ajndkr.com

Installation

The library is available on PyPI and can be installed via pip:

pip install lanarky

Getting Started

Lanarky provides a powerful abstraction layer to allow developers to build simple LLM microservices in just a few lines of code.

Here's an example to build a simple microservice that uses OpenAI's ChatCompletion service:

from lanarky import Lanarky
from lanarky.adapters.openai.resources import ChatCompletionResource
from lanarky.adapters.openai.routing import OpenAIAPIRouter

app = Lanarky()
router = OpenAIAPIRouter()


@router.post("/chat")
def chat(stream: bool = True) -> ChatCompletionResource:
    system = "You are a sassy assistant"
    return ChatCompletionResource(stream=stream, system=system)


app.include_router(router)

Visit Getting Started for the full tutorial on building and testing your first LLM microservice with Lanarky.

Contributing

Code check Publish

Contributions are more than welcome! If you have an idea for a new feature or want to help improve lanarky, please create an issue or submit a pull request on GitHub.

See CONTRIBUTING.md for more information.

See Lanarky Roadmap for the list of new features and future milestones.

License

The library is released under the MIT License.

Core symbols most depended-on inside this repo

_construct_message
called by 10
lanarky/adapters/langchain/callbacks.py
Depends
called by 9
lanarky/adapters/openai/dependencies.py
get_token_data
called by 8
lanarky/adapters/langchain/callbacks.py
on_chain_end
called by 8
lanarky/adapters/langchain/callbacks.py
model_dump
called by 7
lanarky/utils.py
on_chain_end
called by 6
lanarky/adapters/langchain/callbacks.py
on_llm_new_token
called by 6
lanarky/adapters/langchain/callbacks.py
send
called by 5
lanarky/adapters/langchain/callbacks.py

Shape

Function 86
Method 62
Class 35
Route 2

Languages

Python100%

Modules by API surface

lanarky/adapters/langchain/callbacks.py39 symbols
tests/adapters/langchain/test_langchain_callbacks.py12 symbols
lanarky/adapters/openai/resources.py10 symbols
lanarky/clients.py9 symbols
lanarky/adapters/langchain/utils.py9 symbols
lanarky/applications.py7 symbols
lanarky/adapters/openai/utils.py7 symbols
lanarky/adapters/openai/routing.py7 symbols
lanarky/adapters/langchain/routing.py7 symbols
lanarky/websockets.py6 symbols
tests/test_websockets.py5 symbols
tests/adapters/langchain/test_langchain_routing.py5 symbols

For agents

$ claude mcp add lanarky \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page