Crates.io | amsterdam |
lib.rs | amsterdam |
version | |
source | src |
created_at | 2024-10-30 21:57:15.98333 |
updated_at | 2024-11-29 18:35:28.635939 |
description | A gateway for observing, routing, and transforming prompts. |
homepage | |
repository | |
max_upload_size | |
id | 1429286 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Routing: route requests to suitable LLM providers, (possibly using something like https://github.com/lm-sys/RouteLLM)
Monitoring:
Tracking: group requests by templates / tags and threads
Modifying: allow requests to specify what parts of a prompt are variable, store the templates in a database, and experiment with different templates.
The gateway has endpoints that mimic LLM API endpoints, but with additional fields to support the features above.
For example for the OpenAI API the request body would look like this:
"messages": [
{
"role": "user",
"content": "Hello Tinco!"
"template": "Hello {{ name }}!",
"template_id": "bla_template-v1.2321beta5",
"variables": {
"name": "Tinco"
}
}
],
"agent_id": "greeting-agent-v1.1231beta5",
"run_id": "abcdef123",
"request_parent_id": "abcdef123",
"request_id": "abcdef123"
template_id
allows us to easily group requests.Gateway endpoints start with /v<version>/<provider>
, for example /v1/openai/v1/chat/completions
. To ensure
compatibility, the requests are proxied to the provider as-is, with the additional fields stripped off.