Patryk Studzinski commited on
Commit
8b7c684
·
1 Parent(s): 1569809

adding custom prompt messages

Browse files
Files changed (2) hide show
  1. app/main.py +4 -1
  2. app/schemas/schemas.py +1 -0
app/main.py CHANGED
@@ -407,7 +407,10 @@ async def process_infill_item(
407
  )
408
 
409
  # Build prompt
410
- chat_messages = create_infill_prompt(normalized_text, options, attributes=item.attributes)
 
 
 
411
 
412
  # Generate
413
  llm = await registry.get_model(model_name)
 
407
  )
408
 
409
  # Build prompt
410
+ if item.custom_messages:
411
+ chat_messages = item.custom_messages
412
+ else:
413
+ chat_messages = create_infill_prompt(normalized_text, options, attributes=item.attributes)
414
 
415
  # Generate
416
  llm = await registry.get_model(model_name)
app/schemas/schemas.py CHANGED
@@ -16,6 +16,7 @@ class InfillItem(BaseModel):
16
  id: str = Field(..., description="Unique identifier for this item")
17
  text_with_gaps: str = Field(..., description="Text containing [GAP:n] markers or ___ to fill")
18
  attributes: Dict[str, Any] = Field(default_factory=dict, description="Optional context attributes (e.g. make, model)")
 
19
 
20
 
21
  class InfillOptions(BaseModel):
 
16
  id: str = Field(..., description="Unique identifier for this item")
17
  text_with_gaps: str = Field(..., description="Text containing [GAP:n] markers or ___ to fill")
18
  attributes: Dict[str, Any] = Field(default_factory=dict, description="Optional context attributes (e.g. make, model)")
19
+ custom_messages: Optional[List[Dict[str, str]]] = Field(None, description="Optional pre-built chat messages to override prompt generation")
20
 
21
 
22
  class InfillOptions(BaseModel):