71 Commits

Author SHA1 Message Date
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
Marco Milanta
37005c03be fix: add tests (and found bug) 2025-04-02 16:03:51 +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
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
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
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
22acb38131 Add tests for the guardrails integration for open_ai route. 2025-03-18 14:46:22 +01:00
Hemang
c4ecc01a59 Remove unnecessary playwright dependency for tests. 2025-03-13 10:12:55 +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
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
Hemang
300130e815 Fix broken tests. 2025-03-12 19:17:13 +01:00
Hemang
2fe0f55cb3 Don't block on push to explorer call for the routes. 2025-03-10 17:25:39 +01:00
Hemang
20f8a12032 Formatting changes. 2025-03-10 15:18:13 +01:00
Hemang
abbc80890d Add tests with tool_calls for Gemini. 2025-03-10 15:18:13 +01:00
Hemang
fdc9da16c0 Add tests for some non tool_call cases for Gemini integration. 2025-03-10 15:18:13 +01:00
Hemang
7576f245bd Add a converter module to house conversion from different LLM provider formats to Invariant API format. 2025-03-10 15:18:13 +01:00
Hemang Sarkar
adfabd5b12 Update the format where the user passes the invariant key in the llm provider key header. (#18) 2025-03-06 10:57:32 +01:00
Hemang
7008f73310 Rename proxy to gateway. 2025-03-05 14:35:39 +01:00
Zishan
79c934ef45 fix anthropic test 2025-02-27 10:30:33 +01:00
Hemang
1795fd4a23 Rename containers 2025-02-27 10:30:13 +01:00
Hemang
320c410493 Add test for OpenAI so that we verify that the Invariant API Key can be passed inside the OpenAI Key header. 2025-02-26 09:59:08 +01:00
Hemang
6afbcd3ea0 Add API endpoints so that the Proxy can be used without pushing to Explorer. 2025-02-25 22:38:15 +01:00
zishan-wei
4ed63ec4e3 add anthropic image handle
add anthropic image handle
2025-02-24 10:17:24 +01:00
Zishan
2825b25754 change anthropic test 2025-02-21 16:47:52 +01:00
Zishan
65b0693299 add anthropic image handle 2025-02-21 12:02:37 +01:00
zishan-wei
daa7128971 Anthropic related add
Anthropic related add
2025-02-20 17:24:05 +01:00
Zishan
45b9872d73 change the way of sending streaming request and specify zurich, switzerland in prompt 2025-02-20 13:43:46 +01:00
Hemang
f59a6a7cb3 Add a test for the error scenario from OpenAI. It is marked as skipped for now. 2025-02-20 12:11:56 +01:00
Zishan
ecc7f41adf Merge branch 'main' into anthropic-add 2025-02-20 10:47:58 +01:00
Zishan
2dd3049926 add anthropic header test 2025-02-20 10:45:21 +01:00
Hemang
b1dedee9ee Add @pytest.mark.skipif to the openai image chat completion test. 2025-02-19 17:39:46 +01:00
Hemang
8fa127ff38 Add a test with openai and an image in the chat. 2025-02-19 17:13:38 +01:00
Zishan
0adf3729c2 remove useless code 2025-02-18 16:46:51 +01:00
Zishan
b3c5fb4d47 complete anthropic test 2025-02-18 14:54:09 +01:00
Zishan
5765dac764 rename anthropic test file names 2025-02-17 15:27:11 +01:00
Zishan
d5de1f7d57 Merge branch 'main' into anthropic-implement 2025-02-17 15:11:41 +01:00
Zishan
3c0637b946 organize anthropic test 2025-02-17 15:09:03 +01:00
Hemang
891abf2952 Change some names for the test stack. 2025-02-13 15:46:09 +01:00
Zishan
4276aad7be change prompt and add try/except for streming call 2025-02-13 10:54:29 +01:00
Zishan
768e655947 adjust pytest 2025-02-12 17:32:10 +01:00