diff --git a/anki_generator/clients/llm.py b/anki_generator/clients/llm.py index f0c2a60..9a690af 100644 --- a/anki_generator/clients/llm.py +++ b/anki_generator/clients/llm.py @@ -16,7 +16,8 @@ class AnthropicClient: """Get card information from Anthropic API""" prompt = f""" Create an Anki card for the German word "{word}" (source: {source}). - Return the response in the following JSON format: + IMPORTANT: Respond with ONLY the JSON object, no other text. + Format: {{ "german_word": "", "part_of_speech": "", @@ -36,7 +37,7 @@ class AnthropicClient: model=self.model, max_tokens=self.max_tokens, temperature=self.temperature, - system="You are a helpful German language teaching assistant. Always respond with valid JSON.", + system="You are a helpful German language teaching assistant. Return ONLY valid JSON without any additional text or explanations.", messages=[ { "role": "user", @@ -49,4 +50,4 @@ class AnthropicClient: return json.loads(message.content[0].text) except (json.JSONDecodeError, IndexError) as e: print(message) - raise ValueError(f"Failed to parse API response as JSON: {e}") \ No newline at end of file + raise ValueError(f"Failed to parse API response as JSON: {e}")