Skip to content

Commit c915192

Browse files
committed
fix tweak don't call openAI when no IMO
1 parent 23a3cca commit c915192

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

zavod/zavod/extract/llm.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@ def run_text_prompt(
156156
model: str = DEFAULT_MODEL,
157157
) -> TextPromptResponse:
158158
"""Run a text prompt."""
159-
# Maritime: Skip OpenAI calls unless text contains "IMO"
160-
if "imo" not in string.lower():
161-
log.info("Skipping GPT (no IMO): %s" % string[:50])
162-
return {}
163159
client = get_client()
164160
cache_hash = sha1(string.encode("utf-8"))
165161
cache_hash.update(prompt.encode("utf-8"))
@@ -169,6 +165,10 @@ def run_text_prompt(
169165
log.info("GPT cache hit: %s" % string[:50])
170166
return TextPromptResponse(content=cached_data, cache_key=cache_key)
171167
log.info("Prompting %r for: %s" % (model, string[:50]))
168+
# Maritime: Skip OpenAI calls unless text contains "IMO"
169+
if "imo" not in string.lower():
170+
log.info("Skipping GPT (no IMO): %s" % string[:50])
171+
return TextPromptResponse(content=string, cache_key=cache_key)
172172
response = client.chat.completions.create(
173173
model=model,
174174
messages=[

0 commit comments

Comments
 (0)