-
-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(llm): save topic prompts after generation
- Loading branch information
1 parent
8e45a7c
commit b554a62
Showing
3 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
Classes for instantiating objects received from the LLM repo | ||
""" | ||
from typing import List | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class TopicPrompt: | ||
title: str | ||
prompt: str | ||
lang: str | ||
ref: str | ||
slug: str | ||
|
||
|
||
@dataclass | ||
class TopicPromptGenerationOutput: | ||
lang: str | ||
prompts: List[TopicPrompt] | ||
|
||
@staticmethod | ||
def create(raw_output): | ||
return TopicPromptGenerationOutput( | ||
**{**raw_output, "prompts": [TopicPrompt(**raw_prompt) for raw_prompt in raw_output['prompts']]} | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters