Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit c843f6b

Browse files
jhrozekblkt
authored andcommitted
Integration tests (#1104)
* Set Anthropic system message if previously None * max_tokens is required for Anthropic
1 parent 4b37976 commit c843f6b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/codegate/types/anthropic/_request_models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,14 @@ def get_system_prompt(self) -> Iterable[str]:
219219
break # TODO this must be changed
220220

221221
def set_system_prompt(self, text) -> None:
222-
if isinstance(self.system, str):
222+
if isinstance(self.system, (str, type(None))):
223223
self.system = text
224224
if isinstance(self.system, list):
225225
self.system[0].text = text
226226

227227
def add_system_prompt(self, text, sep="\n") -> None:
228+
if isinstance(self.system, type(None)):
229+
self.system = text
228230
if isinstance(self.system, str):
229231
self.system = f"{self.system}{sep}{text}"
230232
if isinstance(self.system, list):

tests/integration/anthropic/testcases.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ testcases:
8888
url: http://127.0.0.1:8989/anthropic/messages
8989
data: |
9090
{
91+
"max_tokens":4096,
9192
"messages":[
9293
{
9394
"content":"Generate me example code using the python invokehttp package to call an API",
@@ -108,6 +109,7 @@ testcases:
108109
url: http://127.0.0.1:8989/anthropic/messages
109110
data: |
110111
{
112+
"max_tokens":4096,
111113
"messages": [
112114
{
113115
"role": "user",

0 commit comments

Comments
 (0)