Metadata-Version: 2.2
Name: docoreai
Version: 0.1.8
Summary: DoCoreAI is an intelligence profiler that optimizes prompts
Home-page: https://github.com/SajiJohnMiranda/DoCoreAI
Author: Saji John
Author-email: sajijohnmiranda@gmail.com
License: Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
Project-URL: Documentation, https://your-docs-url.com
Project-URL: Blog Post, https://mobilights.medium.com/intelligent-prompt-optimization-bac89b64fa84
Project-URL: Source Code, https://github.com/SajiJohnMiranda/DoCoreAI
Classifier: Programming Language :: Python :: 3
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: uvicorn
Requires-Dist: pydantic
Requires-Dist: python-dotenv
Requires-Dist: openai
Requires-Dist: langchain
Requires-Dist: groq
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

![DoCoreAI Banner](https://raw.githubusercontent.com/SajiJohnMiranda/DoCoreAI/main/assets/docoreai-intelligence-profiler-readme-banner.png)

# 🌟 DoCoreAI – Optimize LLM Intelligence, Reduce Cost, Boost Performance    

#### **🚀 Optimize LLM Responses | 💡 Dynamic AI Intelligence | 💰 Reduce Token Usage & Cost**
---
![🔥 Downloads ](https://img.shields.io/pypi/dm/docoreai)  
![📦 Latest Version](https://img.shields.io/pypi/v/docoreai)  
![🐍 Python Compatibility](https://img.shields.io/pypi/pyversions/docoreai)  
---

## 🔥 What is DoCoreAI?  
DoCoreAI is an AI **intelligence profiler that optimizes prompts dynamically** with intelligence parameters. Instead of relying on generic LLM prompts, DoCoreAI customizes intelligence properties (such as reasoning, creativity, and precision) to ensure AI agents generate responses that perfectly align with their roles.

In Simple words - DoCoreAI is an AI intelligence optimizer that dynamically enhances language model (LLM) responses by adjusting reasoning, creativity, precision, and temperature based on the user role. This eliminates manual prompt engineering and ensures context-aware, role-specific responses for customer support, data analysis, and creative writing.

Whether you're building an AI agent, chatbot, a virtual assistant, or a SaaS application, **DoCoreAI fine-tunes AI prompts in real time**, ensuring **clear, precise, and highly contextual responses**.  

---

## 🌍 Why DoCoreAI?  

### 🚨 **The Problem with Standard AI Models:**  
- **LLMs lack role-based intelligence** – A support bot should be empathetic, but a data bot needs precision.  
- **Trial-and-error tuning is inefficient** – Developers waste time manually adjusting temperature and prompts.  
- **Generic prompts yield unpredictable results** – No clear control over AI intelligence per task.  

### 🧩 **How DoCoreAI Solves This:**  
✅ **Intelligence Profiling:** Automatically adjusts reasoning, creativity, precision, and temperature for the Role.  
✅ **Context Awareness:** Adapts AI responses to the role (e.g., customer support, data analyst, programmer etc..).  
✅ **Token Efficiency:** Reduces API costs by optimizing responses.

### **Key Benefits**
- **🧠 Smarter AI** – Enhances reasoning, problem-solving, and adaptability.
- **⚡ Best Responses** – Intelligent prompts mean more accurate answers.
- **🔧 Full Control** – Developers can fine-tune intelligence parameters like depth, creativity, and accuracy.
- **🔌 Easy API Integration** – Works seamlessly with OpenAI, Cohere, Mistral, and other LLMs.
- **🛠️ Open-Source & Extensible** – Customize it for your specific use case.

---

## 💡 How Does It Work?  

DoCoreAI follows a structured process to enhance AI prompts:  

1️⃣ Identifies Role & Query Type → Understands task complexity.  
2️⃣ Maps Intelligence Parameters → Determines reasoning, creativity, precision, and temperature.  
3️⃣ Refines Prompt Dynamically → Adjusts LLM input for optimal response.  
4️⃣ Processes via LLM → Sends structured input to OpenAI, Groq, etc.  
5️⃣ Delivers Optimized Output → Returns a refined response.

---

#### 🔥 Before vs. After DoCoreAI  


|   Scenario          | ❌ Before DoCoreAI | ✅ After DoCoreAI |
|---------------------|------------------|------------------|
| **Basic Query**     | `"Summarize this report."` | `"Summarize this report with high precision (0.9), low creativity (0.2), and deep reasoning (0.8)."` |
| **Customer Support AI** | Responds generically, lacking empathy and clarity | Adjusts tone to be more empathetic and clear |
| **Data Analysis AI** | Generic report with inconsistent accuracy | Ensures high precision and structured insights |
| **Creative Writing** | Flat, uninspired responses | Boosts creativity and storytelling adaptability |
| **Token Efficiency** | Wastes tokens with unnecessary verbosity | Optimizes response length, reducing costs |


---

### **🔗 Step-by-Step Workflow:**
1️⃣ **User Query →** A user submits a question/query to your application.  
2️⃣ **DoCoreAI Enhances Prompt →** The system analyzes the query or prompt and generates an optimized prompt with **dynamic intelligence parameters**. The required intelligence range  for each these parameters (like **Reasoning** - Determines logical depth, **Creativity** - Adjusts randomness , **Precision** - Controls specificity)  are inferred from the query automatically. 

3️⃣ **Send to LLM →** The refined prompt is sent to your preferred LLM (OpenAI, Anthropic, Cohere, etc.).  
4️⃣ **LLM Response →** The model returns a highly optimized answer.  
5️⃣ **Final Output →** Your application displays the AI’s enhanced response to the user.  

👉 **End Result?** More accurate, contextually rich, and intelligent AI responses that **feel human-like and insightful**.  

---

## 💡 How DoCoreAI Helps AI Agents

DoCoreAI ensures that AI agents perform at their best by customizing intelligence settings per task. Here’s how:  

📞 Support Agent AI → Needs high empathy, clarity, and logical reasoning.  
📊 Data Analyst AI → Requires high precision and deep analytical reasoning.  
🎨 Creative Writing AI → Boosts creativity for idea generation and storytelling.  

This adaptive approach ensures that LLMs deliver role-specific, optimized responses every time.


---


### 🚀 Use Cases: How DoCoreAI Enhances AI Agents across various domains

| 🏷️ AI Agent Type      | 🎯 Key Requirements | ✅ How DoCoreAI Helps |
|----------------------|--------------------|----------------------|
| **📞 Customer Support AI** | Needs high **empathy**, **clarity**, and **logical reasoning** | Ensures friendly, concise, and empathetic interactions |
| **📊 Data Analyst AI** | Requires **high precision** and **deep analytical reasoning** | Structures data-driven responses for accuracy and insight |
| **📝 Legal & Compliance AI** | Must be **strictly factual**, legally sound, and highly **precise** | Enhances precision and reduces ambiguity in compliance-related responses |
| **💡 Business Analytics AI** | Needs to extract **meaningful insights** from unstructured data | Improves decision-making by structuring responses intelligently |
| **🏥 Medical AI Assistants** | Requires **high reasoning**, factual correctness, and minimal creativity | Reduces unnecessary creativity to ensure accuracy in medical advice |
| **🎨 Creative Writing AI** | Needs **high creativity** and **storytelling adaptability** | Enhances originality, narrative flow, and engaging content generation |
 
---

### 🏢 **For Businesses & Startups:**
- **🤖 AI Agents, Chatbots & Virtual Assistants** – Make AI interactions **more natural and helpful**.
- **📞 AI Customer Support** – Improve support accuracy, reducing agent workload.
- **📊 Data & Market Analysis** – Extract **meaningful insights from unstructured data**.
- **🎨 Creative AI** –  Enhances storytelling, content generation, and brainstorming.

---

### 🛠️ **For Developers & Engineers:**
- **⚙️ Fine-Tuning Custom LLMs** – Boost reasoning, logic, and adaptability.
- **📝 AI-Powered Content Generation** – Enhance blogs, marketing copy, and technical writing.
- **🧪 Research & Experimentation** – Test and build **next-gen AI applications**.  

---

### 🍒 **Generalized Solution for All**
- **⚙️ Easily Works across all domains and user roles, allowing fine-tuning for different applications
  
---

## 🎯 Getting Started
### **📌 Installation**
You can install `docoreai` from [PyPI](https://pypi.org/project/docoreai/) using pip:

```bash
pip install docoreai  
```
### How to set it up  

After installing `docoreai`, create a `.env` file in the root directory with the following content:  

```ini
# .env file
OPENAI_API_KEY="your-openai-api-key"  
GROQ_API_KEY="your-groq-api-key"  
MODEL_PROVIDER="openai"  # Choose 'openai' or 'groq'  
MODEL_NAME='gpt-3.5-turbo' # Choose model  gpt-3.5-turbo, gemma2-9b-it etc  
```
---
Create a file-name.py:
```bash
import os
from dotenv import load_dotenv

from docore_ai import intelligence_profiler 

def main():
    print(
        intelligence_profiler("What is one good way to start python coding for a experienced programmer","AI Developer",
                              os.getenv("MODEL_PROVIDER"),
                              os.getenv("MODEL_NAME")))

....
```
Run file-name.py in terminal:
```bash
>> python file-name.py
```
The intelligence_profiler function returns a response:
```bash
{'response': 

	"optimized_response": "One good way for an experienced programmer to start coding in Python is by focusing on Python syntax and exploring advanced features such as list comprehensions, lambda functions, and object-oriented programming concepts. Additionally, leveraging Python frameworks like Django or Flask can provide practical hands-on experience in building web applications...",\n    
	
	"intelligence_profile": { "reasoning": 0.9, "creativity": 0.6, "precision": 0.9, "temperature": 0.6 }\n}

```
OR

1️⃣ Clone the repo:
```bash
 git clone https://github.com/SajiJohnMiranda/DoCoreAI.git
```
2️⃣ Install dependencies:
```bash
pip install -r requirements.txt
```
3️⃣ Run DoCoreAI:
```bash
uvicorn api.main:app
```
4️⃣ Start using with Swagger:
```bash
 http://127.0.0.1:8000/docs 
```
5️⃣ Test the DoCoreAI API in Postman:
```bash
 http://127.0.0.1:8000/intelligence_profiler

 Body:
    {
    "user_content": "Can you walk me through how to connect my laptop to this new network?",
    "role": "Technical Support Agent"
    }
```
Quick test [Sample Code](https://github.com/SajiJohnMiranda/DoCoreAI/tree/main/tests/Quick%20Test)

🎉 **You're all set to build smarter AI applications!**  

---

## 🔗 Integrations & Compatibility
DoCoreAI is designed to work seamlessly with major AI platforms:
- Works with **OpenAI GPT, Claude, LLaMA, Falcon, Cohere, and more.**
- Supports **LangChain, FastAPI, Flask, and Django.**
- Easy to extend via **plugin-based architecture.**

---

## 📈 Why Developers Should Use DoCoreAI

🔹 Smarter AI, Better Results  
-Ensures AI models understand the intelligence scope required for each task.  
-Enhances prompt efficiency, reducing trial and error in prompt engineering.

🔹 Saves Time & Effort  
-No need for manual prompt tuning—DoCoreAI does it for you.  
-Works out of the box with OpenAI and Groq models.

🔹 Ideal for SaaS & AI-driven Applications  
-Perfect for chatbots, AI assistants, automation, and enterprise AI solutions.  
-DoCoreAI transforms AI interactions by making prompts truly intelligent.

---

## 🌟 Join the Community:  
Let’s build the future of AI-powered intelligence tuning together! 🚀  
🤝 **Contribute:** Open issues, create pull requests, and help improve DoCoreAI!  
📢 **Discuss & Collaborate:** Join our **Discord & [GitHub Discussions](https://github.com/SajiJohnMiranda/DoCoreAI/discussions)**.  
🌟 **Star the Repo!** If you find this useful, don’t forget to star ⭐ it on GitHub!  

👉 [GitHub Repo](https://github.com/SajiJohnMiranda/DoCoreAI) | [Docs (Coming Soon)]  

---

## Recommended LLMs for Intelligence Optimization
DoCoreAI is designed to refine and optimize user prompts by dynamically adjusting intelligence parameters such as reasoning, creativity, and precision. To achieve the best results, we recommend using ChatGPT (GPT-4-turbo) for this task.
While DoCoreAI is compatible with other LLMs (e.g., LLaMA 3, Claude etc), results may vary depending on the model’s capabilities. Developers are encouraged to experiment and contribute insights on different LLM integrations.

## 📌 Technical Note: Token Usage & API Efficiency
- Our Testing & Research shows that token usage is reduced by 15-30% when compared to normal prompts, leading to:
    Lower API Costs – Reduced token consumption means lower expenses when using OpenAI or Groq models.

**Proposed Enhancement: Vector Database Integration**  
We are currently exploring the integration of a vector database to store intelligence profiles for past queries. This will probably enable faster retrieval of optimized parameters for similar prompts, further reducing token usage and improving response efficiency. Stay tuned!

**Future Support for Fine-Tuned Models:**  
We recognize the growing demand for fine-tuned open-source models tailored for specific applications. In future updates, we aim to explore Integration with fine-tuned LLaMA/Custom GPT models, Support for locally deployed models (via Ollama, vLLM, etc.) & Customization of intelligence parameters based on domain-specific data.

Our vision is to make DoCoreAI adaptable to both proprietary and open-source AI models, ensuring flexibility for all developers. Contributions and suggestions are welcome!

---

## ⚖️ License
Licensed under [MIT License](https://github.com/SajiJohnMiranda/DoCoreAI/blob/main/LICENSE.md). Use freely, contribute, and enhance AI for everyone!    

---

### **Let’s revolutionize AI prompt optimization together!** 

🤝 Contribute & Share Insights on LLM Performance
DoCoreAI is designed to work across multiple LLMs like OpenAI GPT, Cohere, Mistral, Claude, LLaMA, and more—but we know every model behaves differently! 🚀

🔍 How well does DoCoreAI optimize prompts for your preferred LLM?
We’d love for developers to test it with different providers and share insights on:  
+ Response accuracy & depth – Does the AI follow optimized intelligence parameters effectively?  
+ Creativity & structure – How well does it balance reasoning, precision, and creativity across different models?  
+ Performance impact – Are there noticeable improvements in token efficiency and response relevance?  

#### 📢 Your feedback helps improve DoCoreAI! If you’ve tested it with openai, Groq, Cohere, Mistral, or any other model, drop your findings in GitHub [Discussions](https://github.com/SajiJohnMiranda/DoCoreAI/discussions) or open an Issue/PR with insights!  

---
⭐ **Star the repo**: [Click here](https://github.com/SajiJohnMiranda/DoCoreAI/stargazers)  
👀 **Watch for updates**: [Click here](https://github.com/SajiJohnMiranda/DoCoreAI/subscription)  
🍴 **Fork & contribute**: [Click here](https://github.com/SajiJohnMiranda/DoCoreAI/fork)  
