narrative¶
Content optimization module for Direktor.
direktor.core.narrative
¶
Narrative optimization module for Direktor.
Provides content optimization, NLP narrative enhancement, and grapheme-level optimization using the OpenAI API.
content_optimization(content)
¶
Optimize content for clarity, engagement, and readability.
get_ai_response(prompt, content, max_tokens=1000)
¶
Get an AI response from the OpenAI API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt
|
str
|
System prompt for the AI. |
required |
content
|
str
|
User content to process. |
required |
max_tokens
|
int
|
Maximum tokens in the response. |
1000
|
Returns:
| Type | Description |
|---|---|
str
|
AI response content. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the response content is empty. |
Source code in direktor/core/narrative.py
grapheme_optimization(content)
¶
Optimize content at the grapheme (character) level.
nlp_narrative_enhancement(content)
¶
Enhance content using neuro-linguistic programming techniques.
optimize_content(input_content)
¶
Optimize content through multiple enhancement stages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_content
|
str
|
Original content to optimize. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Fully optimized content. |