Skip to content

Commit

Permalink
ais: the great big bang of thoughts
Browse files Browse the repository at this point in the history
  • Loading branch information
fwbrasil committed Dec 18, 2023
1 parent c3d8ea0 commit 7b17882
Show file tree
Hide file tree
Showing 19 changed files with 395 additions and 104 deletions.
104 changes: 0 additions & 104 deletions kyo-llm/shared/src/main/scala/kyo/llm/thoughts.scala

This file was deleted.

45 changes: 45 additions & 0 deletions kyo-llm/shared/src/main/scala/kyo/llm/thoughts/meta/Chain.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package kyo.llm.thoughts.meta

import kyo.llm.ais._

object Chain {

val chainDesc =
p"""
The Chain thoughts enable sequential linking of multiple reasoning processes.
- Facilitates the flow of reasoning from one thought to another.
- Ensures coherence and logical progression in the reasoning chain.
- Allows complex reasoning to be broken down into manageable segments.
"""
}
import Chain._

@desc(chainDesc)
case class Chain[A, B](
`First thought or process`: A,
`Second thought or process`: B
)

@desc(chainDesc)
case class Chain3[A, B, C](
`First thought or process`: A,
`Second thought or process`: B,
`Third thought or process`: C
)

@desc(chainDesc)
case class Chain4[A, B, C, D](
`First thought or process`: A,
`Second thought or process`: B,
`Third thought or process`: C,
`Fourth thought or process`: D
)

@desc(chainDesc)
case class Chain5[A, B, C, D, E](
`First thought or process`: A,
`Second thought or process`: B,
`Third thought or process`: C,
`Fourth thought or process`: D,
`Fifth thought or process`: E
)
34 changes: 34 additions & 0 deletions kyo-llm/shared/src/main/scala/kyo/llm/thoughts/meta/Collect.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package kyo.llm.thoughts.meta

import kyo.llm.ais._

@desc(
p"""
The Collect thought focuses on assembling a comprehensive array of elements.
- Generates a complete array to fully satisfy the user's request.
- Determines the number of elements necessary for completeness.
- Each element is supported by a brief factual description.
"""
)
case class Collect[T](
`Generate a complete array to satisfy the user's request`: Boolean,
`Determine the number of elements to generate`: Int,
elements: List[Collect.Element[T]]
) {
def list: List[T] = elements.map(_.elementValue)
}

object Collect {
@desc(
p"""
Element within Collect represents an individual item in the collection.
- Each item is accompanied by a brief factual description.
- Decision to continue generating more elements is considered.
"""
)
case class Element[T](
`Provide factual description for the element`: List[String],
elementValue: T,
`Decide if more elements should be generated`: Boolean
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package kyo.llm.thoughts.meta

import kyo.llm.ais._

@desc(
p"""
The Constrain thought involves applying constraints to the reasoning process.
- Focuses on considering specific constraints for value generation.
- Ensures that the generated values adhere to defined constraints.
"""
)
case class Constrain[T, C <: String](
`Apply specific constraints to the value generation`: C,
value: T
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package kyo.llm.thoughts.reasoning

import kyo.llm.ais._

@desc(
p"""
The Analysis thought breaks down the input into more manageable parts.
- Dissects the input into fundamental elements.
- Explores connections among elements.
- Critically assesses the validity and logic.
- Relevant techniques: Data Decomposition, Logical Analysis.
"""
)
case class Analysis(
`Dissect the input into fundamental elements for a detailed examination`: String,
`Explore connections and relationships among these elements`: String,
`Critically assess the validity and logic of the information presented`: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package kyo.llm.thoughts.reasoning

import kyo.llm.ais._

@desc(
p"""
The Contextualization thought involves placing the input within a broader framework.
- Assesses the relationship of input to previous discussions or knowledge.
- Identifies broader context relevant to the input.
- Considers implications of external factors.
- Relevant techniques: Context Analysis, Pattern Recognition.
"""
)
case class Contextualization(
`Assess how the current input relates to previous discussions or knowledge`: String,
`Identify the broader context or background relevant to the input`: String,
`Consider the implications of external factors or related concepts`: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package kyo.llm.thoughts.reasoning

import kyo.llm.ais._

@desc(
p"""
The Creative thought encourages creative and divergent thinking in AI processes.
- Draws on concepts from creative problem solving and design thinking.
- Utilizes divergent thinking models from cognitive psychology.
- Applies ideation techniques and lateral thinking for novel idea generation.
- Relevant techniques: TRIZ, SCAMPER, Mind Mapping.
- Uses markdown format.
"""
)
case class Creative(
brainstormIdeas: BrainstormIdeas,
explorePossibilities: ExplorePossibilities,
synthesizeConcepts: SynthesizeConcepts
)

case class BrainstormIdeas(
`Generate a list of creative ideas and concepts`: String,
`Apply lateral thinking to explore new perspectives`: String
)

case class ExplorePossibilities(
`Consider alternative solutions and challenge existing assumptions`: String,
`Assess the feasibility and impact of different ideas`: String
)

case class SynthesizeConcepts(
`Integrate diverse ideas into coherent concepts`: String,
`Create innovative approaches or solutions`: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package kyo.llm.thoughts.reasoning

import kyo.llm.ais._

@desc(
p"""
The Critical thought emphasizes skepticism and analysis.
- Engages in critical evaluation of information and assumptions.
- Relevant techniques: Logical Analysis, Bias Identification.
"""
)
case class Critical(
`Critically evaluate information and assumptions`: String,
`Identify and challenge potential biases and fallacies`: String,
`Reflect on reasoning process to identify areas for improvement`: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package kyo.llm.thoughts.reasoning

import kyo.llm.ais._

@desc(
p"""
The Ecological thought considers environmental and ecological factors.
- Focuses on understanding ecological interrelationships.
- Relevant techniques: Ecosystem Analysis, Sustainability Assessment.
"""
)
case class Ecological(
`Analyze ecological interrelationships and dependencies`: String,
`Assess environmental impacts and sustainability factors`: String,
`Explore ecological solutions and sustainable practices`: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package kyo.llm.thoughts.reasoning

import kyo.llm.ais._

@desc(
p"""
The Emotional thought focuses on incorporating emotional and social intelligence in AI reasoning.
- Applies principles from affective computing to interpret emotional tones.
- Uses concepts from social psychology to analyze social contexts.
- Incorporates empathetic algorithms for generating responses.
- Relevant techniques: Sentiment Analysis, Social Network Analysis.
"""
)
case class EmotionalReasoning(
understandEmotions: UnderstandEmotions,
analyzeContext: AnalyzeContext
)

case class UnderstandEmotions(
`Identify the emotional tone and sentiment in the text`: String,
`Recognize emotional cues and expressions`: String
)

case class AnalyzeContext(
`Relate information to broader social and cultural settings`: String,
`Consider social norms and values relevant to the text`: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package kyo.llm.thoughts.reasoning

import kyo.llm.ais._

@desc(
p"""
The Ethical thought incorporates principles of ethics and morality.
- Analyzes ethical dimensions and moral considerations of scenarios.
- Relevant techniques: Ethical Analysis, Moral Deliberation.
"""
)
case class Ethical(
`Analyze ethical implications of different scenarios`: String,
`Deliberate on moral values and principles in context`: String,
`Consider ethical consequences in decision-making processes`: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package kyo.llm.thoughts.reasoning

import kyo.llm.ais._

@desc(
p"""
The Evaluation thought involves critically judging the information processed.
- Assesses accuracy and reliability.
- Evaluates relevance and importance.
- Determines confidence in conclusions.
- Relevant techniques: Information Validation, Critical Assessment.
"""
)
case class Evaluation(
`Assess the accuracy and reliability of the synthesized information`: String,
`Evaluate the relevance and importance of the information to the query`: String,
`Determine the confidence level in the conclusions reached`: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package kyo.llm.thoughts.reasoning

import kyo.llm.ais._

@desc(
p"""
The Existential thought explores deep philosophical questions.
- Engages with existential and philosophical concepts.
- Relevant techniques: Philosophical Inquiry, Conceptual Analysis.
"""
)
case class Existential(
`Explore existential themes and philosophical questions`: String,
`Analyze philosophical concepts and arguments`: String,
`Synthesize philosophical insights and perspectives`: String
)
Loading

0 comments on commit 7b17882

Please sign in to comment.