Hi everyone!
I'm excited to share an open source contribution to python LLM ecosystem: Noema-Declarative-AI.
Noema is a Python library designed to seamlessly mix Python code and LLM generations in a declarative and intuitive way.
It's built around the ReAct prompting approach, which structures reasoning in the following steps:
- Question: Define the user input or query.
- Reflection: Think critically about the question.
- Observation: Provide observations based on the reflection.
- Analysis: Formulate an analysis based on observations and reflection.
- Conclusion: Summarize and synthesize the reasoning process.
Here’s an example:
from Noema import *
# Create a subject (LLM)
subject = Subject("../Models/Mistral-NeMo-Minitron-8B-Instruct.Q4_K_M.gguf") # Llama cpp model
# Create a way of thinking
class SimpleWayOfThinking(Noesis):
def __init__(self, task):
super().__init__()
self.task = task
# 'description' name is mandatory
def description(self):
"""
You are a simple thinker. You have a task to perform.
Always looking for the best way to perform it.
"""
task:Information = f"{self.task}" # inject information to the LLM
for i in range(2):
step:Information = f"{i}" # inject information to the LLM
reflexion:Sentence = "Providing a reflexion about the task."
consequence:Sentence = "Providing the consequence of the reflexion."
evaluate:Paragraph = "Evaluating the consequence."
conclusion:Paragraph = "Providing a conclusion which is a synthesis of the previous steps."
return conclusion.value # return the conclusion value
swot = SimpleWayOfThinking("Help me to write a poem.")
conclusion = swot.constitute(subject, verbose=True) # execute the way of thinking
print("LLM output:")
print(subject)
print("Conclusion:")
print(conclusion)
Key Features:
- Programmable prompting: Simplify the process of designing and executing prompts programmatically.
- Declarative paradigm: Focus on describing what you want to achieve, and let the framework handle the how.
- ReAct-inspired reasoning: Promote systematic thinking through a structured reasoning process.
This project is fully open source and still in its early stages (not yet production-ready).
I'm eager to hear your thoughts, feedback, and critiques!
Whether you want to challenge the concept, propose potential use cases, or simply discuss the approach, I’d love to engage with anyone interested.
Looking forward to your input! :)
Top comments (0)