tests: add test for request_haiku

Refs: OPS-70
This commit is contained in:
Christoph J. Scherr 2025-03-21 16:27:34 +01:00
parent aa236775ba
commit 897bf80e38
No known key found for this signature in database
GPG key ID: 9EB784BB202BB7BB
4 changed files with 36 additions and 9 deletions

View file

@ -18,7 +18,7 @@ class Haiku:
return json.dumps(self.lines)
@staticmethod
def request_haiku(seed: str) -> Haiku:
def request_haiku(seed: str, url=AI_BASE_URL + AI_GEN_ENDPOINT) -> Haiku:
"""This function prompts the ai to generate
the hauku based on the user input"""
@ -31,7 +31,7 @@ class Haiku:
while True:
try:
r = requests.post(url=AI_BASE_URL + AI_GEN_ENDPOINT,
r = requests.post(url=url,
json=ai_gen_request)
ai_response = str(r.json()["response"])