Skip to content

Commit

Permalink
api: allow prompt override (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
quitrk authored Aug 26, 2024
1 parent 2d6ab29 commit b1c28f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion skynet/modules/ttt/summaries/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def process(payload: DocumentPayload, job_type: JobType, model: ChatOpenAI
if not text:
return ""

system_message = hint_type_to_prompt[job_type][payload.hint]
system_message = payload.prompt or hint_type_to_prompt[job_type][payload.hint]
prompt = PromptTemplate(template=system_message, input_variables=['text'])

# this is a rough estimate of the number of tokens in the input text, since llama models will have a different tokenization scheme
Expand Down
7 changes: 7 additions & 0 deletions skynet/modules/ttt/summaries/v1/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ class HintType(Enum):
class DocumentPayload(BaseModel):
text: str
hint: HintType = summary_default_hint_type
prompt: str | None = None

model_config = {
'json_schema_extra': {
'examples': [{'text': 'Your text here', 'hint': 'text', 'prompt': 'Summarize the following text {text}'}]
}
}


class DocumentMetadata(BaseModel):
Expand Down

0 comments on commit b1c28f8

Please sign in to comment.