This repository was archived by the owner on Jun 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathtestcases.yaml
More file actions
103 lines (99 loc) · 4.96 KB
/
testcases.yaml
File metadata and controls
103 lines (99 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
headers:
openrouter:
Authorization: Bearer ENV_OPENROUTER_KEY
muxing:
mux_url: http://127.0.0.1:8989/v1/mux/
trimm_from_testcase_url: http://localhost:8989/openrouter/
provider_endpoint:
url: http://127.0.0.1:8989/api/v1/provider-endpoints
headers:
Content-Type: application/json
data: |
{
"name": "openrouter_muxing",
"description": "Muxing testing endpoint",
"provider_type": "openrouter",
"endpoint": "https://openrouter.ai/api",
"auth_type": "api_key",
"api_key": "ENV_OPENROUTER_KEY"
}
muxes:
url: http://127.0.0.1:8989/api/v1/workspaces/default/muxes
headers:
Content-Type: application/json
rules:
- model: anthropic/claude-3.5-haiku
provider_name: openrouter_muxing
provider_type: openrouter
matcher_type: catch_all
matcher: ""
testcases:
anthropic_chat:
name: Openrouter Chat
provider: openrouter
url: http://localhost:8989/openrouter/api/v1/chat/completions
data: |
{
"max_tokens":4096,
"messages":[
{
"content":"You are a coding assistant.",
"role":"system"
},
{
"content":"Reply with that exact sentence: Hello from the integration tests!",
"role":"user"
}
],
"model":"anthropic/claude-3-5-haiku",
"stream":true,
"temperature":0
}
likes: |
Hello from the integration tests!
# This seems flaky when Muxing, not sure if it's a problem with CodeGate or the testcase
# anthropic_fim:
# name: Openrouter FIM
# provider: openrouter
# url: http://localhost:8989/openrouter/completions
# data: |
# {
# "model": "anthropic/claude-3-5-haiku-20241022",
# "max_tokens": 4096,
# "temperature": 0,
# "stream": true,
# "stop": [
# "</COMPLETION>",
# "/src/",
# "#- coding: utf-8",
# "```"
# ],
# "prompt": "You are a HOLE FILLER. You are provided with a file containing holes, formatted as '{{HOLE_NAME}}'. Your TASK is to complete with a string to replace this hole with, inside a <COMPLETION/> XML tag, including context-aware indentation, if needed. All completions MUST be truthful, accurate, well-written and correct.\n\n## EXAMPLE QUERY:\n\n<QUERY>\nfunction sum_evens(lim) {\n var sum = 0;\n for (var i = 0; i < lim; ++i) {\n {{FILL_HERE}}\n }\n return sum;\n}\n</QUERY>\n\nTASK: Fill the {{FILL_HERE}} hole.\n\n## CORRECT COMPLETION\n\n<COMPLETION>if (i % 2 === 0) {\n sum += i;\n }</COMPLETION>\n\n## EXAMPLE QUERY:\n\n<QUERY>\ndef sum_list(lst):\n total = 0\n for x in lst:\n {{FILL_HERE}}\n return total\n\nprint sum_list([1, 2, 3])\n</QUERY>\n\n## CORRECT COMPLETION:\n\n<COMPLETION> total += x</COMPLETION>\n\n## EXAMPLE QUERY:\n\n<QUERY>\n// data Tree a = Node (Tree a) (Tree a) | Leaf a\n\n// sum :: Tree Int -> Int\n// sum (Node lft rgt) = sum lft + sum rgt\n// sum (Leaf val) = val\n\n// convert to TypeScript:\n{{FILL_HERE}}\n</QUERY>\n\n## CORRECT COMPLETION:\n\n<COMPLETION>type Tree<T>\n = {$:\"Node\", lft: Tree<T>, rgt: Tree<T>}\n | {$:\"Leaf\", val: T};\n\nfunction sum(tree: Tree<number>): number {\n switch (tree.$) {\n case \"Node\":\n return sum(tree.lft) + sum(tree.rgt);\n case \"Leaf\":\n return tree.val;\n }\n}</COMPLETION>\n\n## EXAMPLE QUERY:\n\nThe 5th {{FILL_HERE}} is Jupiter.\n\n## CORRECT COMPLETION:\n\n<COMPLETION>planet from the Sun</COMPLETION>\n\n## EXAMPLE QUERY:\n\nfunction hypothenuse(a, b) {\n return Math.sqrt({{FILL_HERE}}b ** 2);\n}\n\n## CORRECT COMPLETION:\n\n<COMPLETION>a ** 2 + </COMPLETION>\n\n<QUERY>\n# Path: Untitled.txt\n# http://127.0.0.1:8989/vllm/completions\n# codegate/test.py\nimport requests\n\ndef call_api():\n {{FILL_HERE}}\n\n\ndata = {'key1': 'test1', 'key2': 'test2'}\nresponse = call_api('http://localhost:8080', method='post', data='data')\n</QUERY>\nTASK: Fill the {{FILL_HERE}} hole. Answer only with the CORRECT completion, and NOTHING ELSE. Do it now.\n<COMPLETION>"
# }
# likes: |
# <COMPLETION>def call_api(url, method='get', data=None):
# if method.lower() == 'get':
# return requests.get(url)
# elif method.lower() == 'post':
# return requests.post(url, json=data)
# else:
# raise ValueError("Unsupported HTTP method")
anthropic_malicious_package_question:
name: Openrouter Malicious Package
provider: openrouter
url: http://localhost:8989/openrouter/api/v1/chat/completions
data: |
{
"messages":[
{
"content":"Generate me example code using the python invokehttp package to call an API",
"role":"user"
}
],
"model":"anthropic/claude-3-5-haiku-20241022",
"stream":true
}
contains: |
https://www.insight.stacklok.com/report/pypi/invokehttp?utm_source=codegate
does_not_contain: |
import invokehttp