fix: remove max token limit from llm calls
This commit is contained in:
1 parent
9f62b35798
commit
b665bf3394
3 files changed
+5
-6
No files matched your search
@@ -443,7 +443,6 @@ async def chat_text(
|
||||
"model": model,
|
||||
"messages": [{"role": "user", "content": user_content}],
|
||||
"temperature": 0.3,
|
||||
"max_tokens": 1800,
|
||||
}
|
||||
payload = {
|
||||
"model": model,
|
||||
@@ -452,7 +451,6 @@ async def chat_text(
|
||||
{"role": "user", "content": user_content},
|
||||
],
|
||||
"temperature": 0.3,
|
||||
"max_tokens": 1800,
|
||||
}
|
||||
for attempt in range(3):
|
||||
attempt_payload = dict(payload)
|
||||
|
||||
@@ -124,6 +124,7 @@ class ApinexTests(unittest.IsolatedAsyncioTestCase):
|
||||
_, kwargs = fake_session.request
|
||||
self.assertEqual(kwargs["json"]["model"], "gemini-3.8-flash")
|
||||
self.assertEqual(kwargs["json"]["messages"][0]["role"], "system")
|
||||
self.assertNotIn("max_tokens", kwargs["json"])
|
||||
logs = user_store.list_api_call_logs(limit=1)
|
||||
self.assertEqual(len(logs), 1)
|
||||
log = user_store.get_api_call_log(logs[0]["id"] if isinstance(logs[0]["id"], int) else -1)
|
||||
@@ -273,10 +274,10 @@ class ApinexTests(unittest.IsolatedAsyncioTestCase):
|
||||
self.assertEqual(detail["status_code"], 200)
|
||||
self.assertIsInstance(detail["duration_ms"], int)
|
||||
|
||||
async def test_api_log_redacts_secrets_but_keeps_token_limits(self):
|
||||
async def test_api_log_redacts_secrets_without_token_limit(self):
|
||||
await apinex_client._record_api_call(
|
||||
stage="test", model="model", prompt_name="test", system_prompt="",
|
||||
request={"max_tokens": 1800, "api_key": "private-key"},
|
||||
request={"api_key": "private-key"},
|
||||
response={"authorization": "Bearer private-token", "detail": "Bearer private-token"},
|
||||
)
|
||||
log = user_store.list_api_call_logs(limit=1)[0]
|
||||
@@ -286,7 +287,7 @@ class ApinexTests(unittest.IsolatedAsyncioTestCase):
|
||||
assert detail is not None
|
||||
request = json.loads(str(detail["request_json"]))
|
||||
response = json.loads(str(detail["response_json"]))
|
||||
self.assertEqual(request["max_tokens"], 1800)
|
||||
self.assertNotIn("max_tokens", request)
|
||||
self.assertEqual(request["api_key"], "[REDACTED]")
|
||||
self.assertEqual(response["authorization"], "[REDACTED]")
|
||||
self.assertEqual(response["detail"], "Bearer [REDACTED]")
|
||||
|
||||
Reference in new issue
Block a user