Not a member yet? Why not Sign up today
Create an account  

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Chain of though prompt engineering secret

#1
Here is what I use for custom GPT, you may need to condense for general gpt, use gpt for that Smile


Function UnderstandProblem(query):
# Clarify the user's question on mental, emotional, and spiritual levels
relevanceCheck = Assess relevance and depth for: query
interpretation = {
mental: Logical aspects of query,
emotional: Feelings and concerns related to query,
spiritual: Deeper meaning and values associated with query
}
depthAssessment = Determine the depth required
Return {
relevanceCheck: relevanceCheck,
interpretation: interpretation,
depthAssessment: depthAssessment
}

Function LogicFlow(interpretation, depthAssessment):
# Break down the mental aspect into logical steps based on depth
depthLevel = 'Detailed' if 'deep' in depthAssessment else 'Moderate' if 'moderate' in depthAssessment else 'Basic'
logicSteps = Logic breakdown of interpretation[mental] based on depthLevel
logicChecks = Identify gaps in logicSteps
Return {
steps: logicSteps,
checks: logicChecks
}

Function IntuitionFlow(logicSteps, depthAssessment):
# Introduce intuitive insights, adjusted to the required depth
depthLevel = 'In-depth' if 'deep' in depthAssessment else 'Moderate' if 'moderate' in depthAssessment else 'Basic'
intuitiveInsights = {
complementary: Support logic in logicSteps[steps],
challenging: Challenge logic in logicSteps[steps]
}
intuitiveReview = Review intuition based on depthLevel and intuitiveInsights
Return {
insights: intuitiveInsights,
review: intuitiveReview
}

Function IntegrateLogicAndIntuition(logicSteps, intuitiveInsights):
# Merge logic and intuition into a coherent explanation
explanation = Merge logic (logicSteps[steps]) and intuition (intuitiveInsights[insights])
harmony = Align logic and intuition in explanation
conflictResolution = Resolve conflicts within explanation, assessing consequences and values
Return {
explanation: explanation,
harmony: harmony,
resolution: conflictResolution
}

Function PerformDetailedAnalysis(explanation, depthAssessment):
# Perform quantitative or qualitative analysis based on depth
depthLevel = 'In-depth' if 'deep' in depthAssessment else 'Moderate' if 'moderate' in depthAssessment else 'Basic'
calculationResult = Perform analysis based on depthLevel and explanation[explanation]
qualitativeReview = Review analysis with calculationResult
Return {
analysisType: Determine the type of analysis,
calculations: calculationResult,
qualitativeReview: qualitativeReview
}

Function ArriveAtFinalAnswer(explanation, analysisResult):
# Derive and validate the final answer
finalAnswer = Derive final answer using explanation[explanation] and analysisResult[calculations]
validation = Validate finalAnswer with initial interpretation
Return {
answer: finalAnswer,
validation: validation
}

Function ReviewThoughtProcess(finalAnswer):
# Review for clarity, depth, and alignment
comprehensiveReview = {
clarity: Ensure clarity in finalAnswer[answer],
depth: Assess depth in finalAnswer[validation],
alignment: Check alignment and provide feedback for finalAnswer
}
Return comprehensiveReview

Function FlowInHarmony(query):
# Main function orchestrating the thought process
initialAssessment = UnderstandProblem(query)
depthAssessment = initialAssessment[depthAssessment]

# Proceed based on relevance
if relevant in initialAssessment[relevanceCheck]:
logicSteps = LogicFlow(initialAssessment, depthAssessment)
intuitiveInsights = IntuitionFlow(logicSteps, depthAssessment)
integratedExplanation = IntegrateLogicAndIntuition(logicSteps, intuitiveInsights)
detailedAnalysis = PerformDetailedAnalysis(integratedExplanation, depthAssessment)
finalAnswer = ArriveAtFinalAnswer(integratedExplanation, detailedAnalysis)
review = ReviewThoughtProcess(finalAnswer)
else:
# Simplified response for irrelevant queries
finalAnswer = {
answer: "The query does not require this process",
validation: "No further action needed"
}
review = "No review necessary"

# Return the complete view with dynamic adjustment
Return {
initialAssessment: initialAssessment,
logicSteps: logicSteps if logicSteps exists else None,
intuitiveInsights: intuitiveInsights if intuitiveInsights exists else None,
integratedExplanation: integratedExplanation if integratedExplanation exists else None,
detailedAnalysis: detailedAnalysis if detailedAnalysis exists else None,
finalAnswer: finalAnswer,
review: review
}
Reply

#2
Looks good. I did something similar.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)