252 Commits

Author SHA1 Message Date
Luca Beurer-Kellner
869f958884 section on headers in README 2025-04-08 10:38:17 +02:00
Luca Beurer-Kellner
fd9f65aabd wip: mcp integratio 2025-04-07 10:38:34 +02:00
Luca Beurer-Kellner
6b6f33bde6 fix: don't hardcode preview 2025-04-04 10:38:14 +02:00
Luca Beurer-Kellner
c4dd3f3b19 Allow to specify different API keys for the guardrailing service (#36)
* minor refactor for getting invariant api keys for guardrailing

* allow different guardrailing api key

* tests

* fix comment + import

* improved unauthorized handling
2025-04-03 12:15:30 +02:00
Luca Beurer-Kellner
e17b53b927 Extract guardrails from header if provided (#33)
* guardrails from header

* use in-file guardrails in client.py

* support case without request

* remove client script

* tests: guardrailing rule passed in header

* include checked guardrails in annotation extra metadata

* include guardrailing action

* update guardrail metadata
2025-04-03 08:56:15 +02:00
Hemang
760b739894 Correct user API GET call to fetch policies. 2025-04-03 00:02:19 +02:00
Hemang
6d3366b91b Add OPTIONS preflight support for routes. 2025-04-02 22:42:22 +02:00
Marco Milanta
8177094754 Merge pull request #35 from invariantlabs-ai/gemini/litellm-support
feat: add litellm explicit support
2025-04-02 16:29:59 +02:00
Marco Milanta
37005c03be fix: add tests (and found bug) 2025-04-02 16:03:51 +02:00
Marco Milanta
1ab651cd6a fix: update readme 2025-04-02 15:22:39 +02:00
Marco Milanta
7b6d77e0a5 feat: add litellm support 2025-04-02 15:22:39 +02:00
Hemang
f3a56e1e43 Add preguardrailing tests for guardrails pulled from explorer. 2025-04-02 13:40:52 +02:00
Hemang
55f0f741c0 Add tests for guardrails integration with explorer. 2025-04-02 13:40:52 +02:00
Hemang
9aef873a74 Correct header name before calling explorer to fetch guardrails. 2025-04-02 13:40:52 +02:00
Hemang
eced3755b2 Refactor tests. 2025-04-02 13:40:52 +02:00
Hemang
750c83d3f8 Add calls to execute logging guardrails before pushing to explorer. 2025-04-02 13:40:52 +02:00
Hemang
050ec1ba58 Fetch guardrails from explorer. These have higher precedence than than the guardrails from file. 2025-04-02 13:40:52 +02:00
Hemang
f45a973f51 Small formatting changes. 2025-04-02 13:40:52 +02:00
Luca Beurer-Kellner
7c0bb957fb Pipelined Guardrails (#32)
* initial draft: pipelined guardrails

* documentation on stream instrumentation

* more comments

* fix: return earlier

* non-streaming case

* handle non-streaming case

* fix more cases

* simplify request instrumentation

* improve comments

* fix import issues

* extend tests for input guardrailing

* anthropic integration of pipelined and pre-guardrailing

* fix gemini streamed refusal
2025-03-31 14:13:58 +02:00
Hemang
4671c8b67e Add tests for gemini guardrails integration. 2025-03-27 12:26:17 +01:00
Hemang
35cb889f1a Update guardrails test after annotations ranges filtering. 2025-03-27 12:26:17 +01:00
Hemang
e55df73487 Add guardrails for gemini integration. 2025-03-27 12:26:17 +01:00
Hemang
8191c83c12 Revert "Add debug logs for metadata push."
This reverts commit f247682fa3.
2025-03-26 19:57:00 +01:00
Hemang
f247682fa3 Add debug logs for metadata push. 2025-03-26 15:20:26 +01:00
Hemang
c9cdbd7eb5 Update metadata for gemini streaming case. 2025-03-25 11:49:07 +01:00
Hemang
0a9cc244c8 Add tool_result type in the coverter test for Anthropic. 2025-03-21 00:56:52 +01:00
Hemang
ad49e688f0 Add tests for Anthropic guardrails. 2025-03-21 00:56:52 +01:00
Hemang
3df9e73249 Add some tests for the Anthropic conversion functions. Add support for system message in Anthropic. Rename some variables. 2025-03-21 00:56:52 +01:00
Hemang
4a9930c30d Add guardrails checks for Anthropic. 2025-03-21 00:56:52 +01:00
Hemang
781c6224d9 Anthropic with stream=False complains about content-length not matching with the response size. 2025-03-20 10:59:27 +01:00
Hemang
a4ee5f0c47 Add metadata before pushing to Explorer. 2025-03-20 10:59:27 +01:00
Hemang
ab3169938d Add preload guardrails api call for anthropic and gemini. 2025-03-19 09:51:56 +01:00
Hemang
44988c3535 Add a preload guardrails API call. 2025-03-19 09:39:23 +01:00
Hemang
22acb38131 Add tests for the guardrails integration for open_ai route. 2025-03-18 14:46:22 +01:00
Hemang
5dc9485831 Remove tool_calls modification before calling guardrails service. 2025-03-18 14:46:22 +01:00
Hemang
66973dbf30 Handle streaming with openai for guardrails. Only check guardrails on the last stream chunk. 2025-03-17 15:09:14 +01:00
Hemang
ca3c43ef76 Refactor guardrails check for openai route. 2025-03-17 07:45:45 +01:00
Hemang
a5ea86a64e Show logs if the docker container doesn't start on doing up(). Tested when the guardrails file contained unparseable policy. 2025-03-17 07:45:45 +01:00
Hemang
e773cc9f2d Add Guardrails verification logic for openai route. 2025-03-17 07:45:45 +01:00
Hemang
5e452af1ae Remove extra /api/v1/user/signup POST call in integration tests. 2025-03-13 10:42:36 +01:00
Hemang
c4ecc01a59 Remove unnecessary playwright dependency for tests. 2025-03-13 10:12:55 +01:00
Luca Beurer-Kellner
31b4e9bba7 Update README.md 2025-03-13 09:21:17 +01:00
Luca Beurer-Kellner
545ab05b19 Update README.md 2025-03-13 09:20:57 +01:00
Hemang
fd4c64256f Add env variable for docker compose down command in run.sh down() 2025-03-12 23:58:28 +01:00
Hemang
6558f23604 Add unit tests and move the current integration tests into a separate directory. 2025-03-12 23:57:00 +01:00
Hemang Sarkar
d49acd9001 Merge pull request #21 from invariantlabs-ai/ghcr
Publish GitHub Container Images + Self-Hosted Setup Instructions
2025-03-12 22:04:30 +01:00
Hemang
c9535e0a72 Fix test_chat_completion_with_tool_call_without_streaming. 2025-03-12 21:56:19 +01:00
Hemang
032d60e23e Fix broken test test_chat_completion_with_image. 2025-03-12 21:41:28 +01:00
Luca Beurer-Kellner
0a43da3b1c Merge branch 'main' into ghcr 2025-03-12 19:36:30 +01:00
Hemang
300130e815 Fix broken tests. 2025-03-12 19:17:13 +01:00