https://github.com/centre-for-humanities-computing/lex-llm
The orchestrator for the Lex LLM
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.5%) to scientific vocabulary
Repository
The orchestrator for the Lex LLM
Basic Info
- Host: GitHub
- Owner: centre-for-humanities-computing
- License: mit
- Language: Python
- Default Branch: main
- Size: 331 KB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 8
- Releases: 3
Metadata Files
README.md
Lex LLM
The orchestrator for the Lex LLM project, enabling intelligent workflow execution and AI-driven responses.
Repositories
This project is part of the broader Lex ecosystem, which includes several interconnected repositories:
| Name | Description | |---------|-----------------------------| | lex-llm | Core Python orchestration logic and API | | lex-ui | Frontend interface for Lex users | | lex-db | Database backend with document storage and search |
API Structure
The main API is defined in src/lex_llm/api/routes.py. The available endpoints are:
POST
/workflows/{workflow_id}/run
Executes a specific workflow by ID. Accepts a JSON payload containing user input, conversation history, and conversation ID. Returns a streaming response in NDJSON format.GET
/workflows/metadata
Retrieves metadata for all available workflows. Useful for discovering what workflows are supported by the system.GET
/workflows/{workflow_id}/metadata
Retrieves metadata for a specific workflow by ID. Returns 404 if the workflow does not exist, along with a list of available workflows.GET
/health
Simple health check endpoint. Returns{"status": "healthy"}when the service is running.Lifespan Events
On startup and shutdown, logs are printed to indicate the state of the AI Orchestration Service.
Example: Calling the Workflow API
Use curl to stream results from a running workflow:
bash
curl -N -X POST "http://0.0.0.0:10000/workflows/test_workflow/run" \
-H "Content-Type: application/json" \
-d '{
"user_input": "Tell me about artificial intelligence.",
"conversation_history": [
{"role": "user", "content": "Hi!"},
{"role": "assistant", "content": "Hello, how can I help you?"}
],
"conversation_id": "123e4567-e89b-12d3-a456-426614174000"
}'
💡 Note: The
-Nflag disables buffering to ensure streaming works properly.
Running the API
This project uses a Makefile to simplify common development and deployment tasks.
Key Commands
Run the production API:
bash make runGenerates the OpenAPI schema and starts the application server.Run in development mode (with hot reload):
bash make run-devInstalls dev dependencies, generates the schema, and starts Uvicorn with auto-reload enabled on port10000.Other Useful Commands: | Command | Description | |--------|-------------| |
make install| Install project and API client dependencies | |make install-dev| Install development dependencies | |make lint| Format and fix code usingruff| |make lint-check| Check formatting and linting without fixing | |make static-type-check| Runmypyfor type checking | |make test| Run unit tests withpytest| |make pr| Run all checks required for a pull request | |make generate-api| Generate OpenAPI client fromlex-db.yaml| |make generate-openapi-schema| Generate OpenAPI schema (openapi/openapi.yaml) |
📌 Tip: Always run
make prbefore pushing changes to ensure everything is consistent.
Communication with LexDB
This project integrates with LexDB via an auto-generated OpenAPI client, enabling robust interaction with the database.
For Developers
- The OpenAPI client is generated using
make generate-api, which uses Docker and OpenAPI Generator. - Generated client is located at
build/lex_db_api. - Supported operations include:
- Listing available tables
- Full-text search across articles
- Vector-based semantic search using embeddings
- Example usage can be found in
src/examples/lex_db_search_example.py.
Example Usage
```python from lexdbapi.configuration import Configuration from lexdbapi.api.lexdbapi import LexDbApi from lexdbapi.models.vectorsearchrequest import VectorSearchRequest from lexdbapi.api_client import ApiClient import os
apihost = os.getenv("DBHOST", "http://0.0.0.0:8000") apiclient = ApiClient(configuration=Configuration(host=apihost)) api = LexDbApi(apiclient=apiclient)
Get available tables
tables = api.get_tables() print("Tables:", tables)
Full-text search
resultsfts = api.getarticles(query="Rundetårn", limit=2) print("Full-text results:", results_fts)
Vector search
reqvector = VectorSearchRequest( querytext="Hvad er Rundetårn?", topk=3, ) resultsvector = api.vectorsearch("openailarge3sections", reqvector) print("Vector search results:", resultsvector)
Fetch full articles from result IDs
if resultsvector.results: articleids = {int(result["sourcearticleid"]) for result in resultsvector.results} fullarticles = api.getarticles(ids=str(list(articleids))) for article in full_articles: print(article) ```
For Users
The LexDB integration enables: - Fast full-text search across all documents - Semantic search using vector embeddings - Access to structured metadata and article content
All database interactions are handled automatically by the application, so no manual setup is required for end users.
🚀 Tip for Contributors: Run
make prbefore submitting changes to ensure linting, typing, and tests pass.
Owner
- Name: Center for Humanities Computing Aarhus
- Login: centre-for-humanities-computing
- Kind: organization
- Email: chcaa@cas.au.dk
- Location: Aarhus, Denmark
- Website: https://chc.au.dk/
- Repositories: 130
- Profile: https://github.com/centre-for-humanities-computing
GitHub Events
Total
- Create event: 10
- Release event: 1
- Issues event: 19
- Watch event: 1
- Delete event: 6
- Issue comment event: 2
- Push event: 31
- Pull request review event: 6
- Pull request review comment event: 4
- Pull request event: 12
Last Year
- Create event: 10
- Release event: 1
- Issues event: 19
- Watch event: 1
- Delete event: 6
- Issue comment event: 2
- Push event: 31
- Pull request review event: 6
- Pull request review comment event: 4
- Pull request event: 12
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Kenneth Enevoldsen | k****n@g****m | 9 |
| Enniwhere | s****i@g****m | 4 |
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 9
- Total pull requests: 3
- Average time to close issues: about 1 month
- Average time to close pull requests: 3 days
- Total issue authors: 1
- Total pull request authors: 2
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 9
- Pull requests: 3
- Average time to close issues: about 1 month
- Average time to close pull requests: 3 days
- Issue authors: 1
- Pull request authors: 2
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- Enniwhere (16)
Pull Request Authors
- Enniwhere (6)
- KennethEnevoldsen (2)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/checkout v3 composite
- astral-sh/setup-uv v4 composite
- actions/checkout v3 composite
- pypa/gh-action-pypi-publish release/v1 composite
- python-semantic-release/python-semantic-release v8.0.4 composite
- python-semantic-release/upload-to-gh-release main composite
- actions/checkout v3 composite
- actions/setup-python v5 composite
- astral-sh/setup-uv v4 composite
- fastapi >=0.115.14
- griptape [all]>=1.7.3
- litellm >=1.72.6
- openapi-generator >=1.0.6
- pydantic >=2.11.7
- pytest-asyncio >=1.0.0
- python-dateutil >=2.9.0.post0
- smolagents [openai]>=1.18.0
- urllib3 >=2.4.0
- uvicorn >=0.35.0
- 195 dependencies