Skip to content

Commit

Permalink
fix(llm): allow for case where link doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
nsantacruz committed Feb 12, 2024
1 parent efe2778 commit 62f28aa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sefaria/helper/llm/topic_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,15 @@ def make_topic_prompt_input(lang: str, sefaria_topic: Topic, orefs: List[Ref], c

def save_topic_prompt_output(output: TopicPromptGenerationOutput) -> None:
for prompt in output.prompts:
link = RefTopicLink().load({
query = {
"ref": prompt.ref,
"toTopic": prompt.slug,
"dataSource": "learning-team",
"linkType": "about",
})
}
link = RefTopicLink().load(query)
if link is None:
link = RefTopicLink(query)
curr_descriptions = getattr(link, "descriptions", {})
description_edits = {output.lang: {
"title": prompt.title, "ai_title": prompt.title,
Expand Down

0 comments on commit 62f28aa

Please sign in to comment.