# Idealist
**Idealist** is a flexible Python library that leverages Large Language Models (LLMs) and embeddings to generate and refine creative ideas while avoiding repetition. It's ideal for generating unique names, themes, or any other creative content.
## Features
- **Dynamic Idea Generation**: Customize parameters to generate a wide range of ideas.
- **Model Flexibility**: Use different LLMs and embedding models supported by LiteLLM.
- **Uniqueness Assurance**: Ensures all generated ideas are unique and not duplicated.
- **Embedding Support**: Uses embeddings to find and avoid similar ideas.
- **Easy to Use**: Simple interface with minimal setup.
## Installation
You can install the library via pip:
~~~bash
pip install infinite-idealist
~~~
## Usage
### Create a New Generator
Here's a basic example of how to use the `IdeaGenerator` class to create a new generator:
~~~python
from idea_generator import IdeaGenerator
import os
def main():
# Set up environment variables for API keys (optional, depending on the model used)
os.environ["OPENAI_API_KEY"] = "your_openai_api_key"
# os.environ["ANTHROPIC_API_KEY"] = "your_anthropic_api_key" # Optional if using Anthropic
# Initialize the IdeaGenerator
generator = IdeaGenerator(
name="Pokemon Names",
description="Generate unique and creative names for Pokemon characters",
model="gpt-4o-mini", # Specify the LLM model
embedding_model="text-embedding-ada-002", # Specify the embedding model
openai_api_key=os.getenv("OPENAI_API_KEY"), # Optional if using OpenAI
anthropic_api_key=os.getenv("ANTHROPIC_API_KEY"), # Optional if using Anthropic
max_recent_ideas=15, # Number of recent ideas to include in prompts
debug=False # Set to True for detailed logs
)
# Setup parameters
parameters = {
"name": "Name of Pokemon"
}
generator.setup_parameters(parameters)
# Generate ideas
for i in range(5):
idea = generator.generate_idea()
if idea:
print(f"Idea #{i+1}: {idea.get('name')}")
else:
print(f"Failed to generate Idea #{i+1}")
if __name__ == "__main__":
main()
~~~
### Load an Existing Generator
You can also load an existing generator by its ID:
~~~python
from idea_generator import IdeaGenerator
import os
def main():
# Set up environment variables for API keys (optional, depending on the model used)
os.environ["OPENAI_API_KEY"] = "your_openai_api_key"
# os.environ["ANTHROPIC_API_KEY"] = "your_anthropic_api_key" # Optional if using Anthropic
# Load an existing IdeaGenerator by ID
generator_id = "pokemon_names_20241212_050458" # Replace with your generator ID
generator = IdeaGenerator.load(
generator_id=generator_id,
model="gpt-4o-mini", # Specify the LLM model used during creation
embedding_model="text-embedding-ada-002", # Specify the embedding model used during creation
openai_api_key=os.getenv("OPENAI_API_KEY"), # Optional if using OpenAI
anthropic_api_key=os.getenv("ANTHROPIC_API_KEY"), # Optional if using Anthropic
max_recent_ideas=15, # Number of recent ideas to include in prompts
debug=False # Set to True for detailed logs
)
# Generate ideas
for i in range(5):
idea = generator.generate_idea()
if idea:
print(f"Idea #{i+1}: {idea.get('name')}")
else:
print(f"Failed to generate Idea #{i+1}")
if __name__ == "__main__":
main()
~~~
## API Reference
### `IdeaGenerator` Class
#### `__init__`
~~~python
IdeaGenerator(
name: str,
description: str,
model: str = "gpt-4o-mini",
embedding_model: str = "text-embedding-ada-002",
anthropic_api_key: Optional[str] = None,
openai_api_key: Optional[str] = None,
max_recent_ideas: int = 20,
debug: bool = False,
generator_id: Optional[str] = None
)
~~~
- **name**: Name of the generator.
- **description**: Description of what this generator creates.
- **model**: The LLM model to use (e.g., 'gpt-4o-mini').
- **embedding_model**: The embedding model to use (e.g., 'text-embedding-ada-002').
- **anthropic_api_key**: API key for Anthropic (optional).
- **openai_api_key**: API key for OpenAI (optional).
- **max_recent_ideas**: Maximum number of recent ideas to include in prompts.
- **debug**: Enables detailed logging if set to `True`.
- **generator_id**: Optional ID to load an existing generator.
#### `load` Class Method
~~~python
@classmethod
load(
generator_id: str,
model: str = "gpt-4o-mini",
embedding_model: str = "text-embedding-ada-002",
anthropic_api_key: Optional[str] = None,
openai_api_key: Optional[str] = None,
max_recent_ideas: int = 20,
debug: bool = False
) -> 'IdeaGenerator'
~~~
- **generator_id**: ID of the generator to load.
- **model**: The LLM model to use (must match the one used during creation).
- **embedding_model**: The embedding model to use (must match the one used during creation).
- **anthropic_api_key**: API key for Anthropic (optional).
- **openai_api_key**: API key for OpenAI (optional).
- **max_recent_ideas**: Maximum number of recent ideas to include in prompts.
- **debug**: Enables detailed logging if set to `True`.
#### `setup_parameters`
~~~python
setup_parameters(parameters: Dict[str, Any])
~~~
- **parameters**: Dictionary defining the structure of generated ideas.
#### `generate_idea`
~~~python
generate_idea() -> Dict
~~~
- Generates a new idea based on the configured parameters.
- Returns a dictionary containing the generated idea.
## Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
The GitHub repository for this project can be found at: [https://github.com/yoheinakajima/idealist](https://github.com/yoheinakajima/idealist)
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/yoheinakajima/infinite-idealist",
"name": "infinite-idealist",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Yohei Nakajima",
"author_email": "Yohei Nakajima <yohei@example.com>",
"download_url": "https://files.pythonhosted.org/packages/52/3b/b7359484fc85a1116b769bd321b477ff32fce6d0e8c1aa6faec99be8e6e8/infinite_idealist-0.1.2.tar.gz",
"platform": null,
"description": "# Idealist\n\n**Idealist** is a flexible Python library that leverages Large Language Models (LLMs) and embeddings to generate and refine creative ideas while avoiding repetition. It's ideal for generating unique names, themes, or any other creative content.\n\n## Features\n\n- **Dynamic Idea Generation**: Customize parameters to generate a wide range of ideas.\n- **Model Flexibility**: Use different LLMs and embedding models supported by LiteLLM.\n- **Uniqueness Assurance**: Ensures all generated ideas are unique and not duplicated.\n- **Embedding Support**: Uses embeddings to find and avoid similar ideas.\n- **Easy to Use**: Simple interface with minimal setup.\n\n## Installation\n\nYou can install the library via pip:\n\n~~~bash\npip install infinite-idealist\n~~~\n\n## Usage\n\n### Create a New Generator\n\nHere's a basic example of how to use the `IdeaGenerator` class to create a new generator:\n\n~~~python\nfrom idea_generator import IdeaGenerator\nimport os\n\ndef main():\n # Set up environment variables for API keys (optional, depending on the model used)\n os.environ[\"OPENAI_API_KEY\"] = \"your_openai_api_key\"\n # os.environ[\"ANTHROPIC_API_KEY\"] = \"your_anthropic_api_key\" # Optional if using Anthropic\n\n # Initialize the IdeaGenerator\n generator = IdeaGenerator(\n name=\"Pokemon Names\",\n description=\"Generate unique and creative names for Pokemon characters\",\n model=\"gpt-4o-mini\", # Specify the LLM model\n embedding_model=\"text-embedding-ada-002\", # Specify the embedding model\n openai_api_key=os.getenv(\"OPENAI_API_KEY\"), # Optional if using OpenAI\n anthropic_api_key=os.getenv(\"ANTHROPIC_API_KEY\"), # Optional if using Anthropic\n max_recent_ideas=15, # Number of recent ideas to include in prompts\n debug=False # Set to True for detailed logs\n )\n\n # Setup parameters\n parameters = {\n \"name\": \"Name of Pokemon\"\n }\n\n generator.setup_parameters(parameters)\n\n # Generate ideas\n for i in range(5):\n idea = generator.generate_idea()\n if idea:\n print(f\"Idea #{i+1}: {idea.get('name')}\")\n else:\n print(f\"Failed to generate Idea #{i+1}\")\n\nif __name__ == \"__main__\":\n main()\n~~~\n\n### Load an Existing Generator\n\nYou can also load an existing generator by its ID:\n\n~~~python\nfrom idea_generator import IdeaGenerator\nimport os\n\ndef main():\n # Set up environment variables for API keys (optional, depending on the model used)\n os.environ[\"OPENAI_API_KEY\"] = \"your_openai_api_key\"\n # os.environ[\"ANTHROPIC_API_KEY\"] = \"your_anthropic_api_key\" # Optional if using Anthropic\n\n # Load an existing IdeaGenerator by ID\n generator_id = \"pokemon_names_20241212_050458\" # Replace with your generator ID\n generator = IdeaGenerator.load(\n generator_id=generator_id,\n model=\"gpt-4o-mini\", # Specify the LLM model used during creation\n embedding_model=\"text-embedding-ada-002\", # Specify the embedding model used during creation\n openai_api_key=os.getenv(\"OPENAI_API_KEY\"), # Optional if using OpenAI\n anthropic_api_key=os.getenv(\"ANTHROPIC_API_KEY\"), # Optional if using Anthropic\n max_recent_ideas=15, # Number of recent ideas to include in prompts\n debug=False # Set to True for detailed logs\n )\n\n # Generate ideas\n for i in range(5):\n idea = generator.generate_idea()\n if idea:\n print(f\"Idea #{i+1}: {idea.get('name')}\")\n else:\n print(f\"Failed to generate Idea #{i+1}\")\n\nif __name__ == \"__main__\":\n main()\n~~~\n\n## API Reference\n\n### `IdeaGenerator` Class\n\n#### `__init__`\n\n~~~python\nIdeaGenerator(\n name: str,\n description: str,\n model: str = \"gpt-4o-mini\",\n embedding_model: str = \"text-embedding-ada-002\",\n anthropic_api_key: Optional[str] = None,\n openai_api_key: Optional[str] = None,\n max_recent_ideas: int = 20,\n debug: bool = False,\n generator_id: Optional[str] = None\n)\n~~~\n\n- **name**: Name of the generator.\n- **description**: Description of what this generator creates.\n- **model**: The LLM model to use (e.g., 'gpt-4o-mini').\n- **embedding_model**: The embedding model to use (e.g., 'text-embedding-ada-002').\n- **anthropic_api_key**: API key for Anthropic (optional).\n- **openai_api_key**: API key for OpenAI (optional).\n- **max_recent_ideas**: Maximum number of recent ideas to include in prompts.\n- **debug**: Enables detailed logging if set to `True`.\n- **generator_id**: Optional ID to load an existing generator.\n\n#### `load` Class Method\n\n~~~python\n@classmethod\nload(\n generator_id: str,\n model: str = \"gpt-4o-mini\",\n embedding_model: str = \"text-embedding-ada-002\",\n anthropic_api_key: Optional[str] = None,\n openai_api_key: Optional[str] = None,\n max_recent_ideas: int = 20,\n debug: bool = False\n) -> 'IdeaGenerator'\n~~~\n\n- **generator_id**: ID of the generator to load.\n- **model**: The LLM model to use (must match the one used during creation).\n- **embedding_model**: The embedding model to use (must match the one used during creation).\n- **anthropic_api_key**: API key for Anthropic (optional).\n- **openai_api_key**: API key for OpenAI (optional).\n- **max_recent_ideas**: Maximum number of recent ideas to include in prompts.\n- **debug**: Enables detailed logging if set to `True`.\n\n#### `setup_parameters`\n\n~~~python\nsetup_parameters(parameters: Dict[str, Any])\n~~~\n\n- **parameters**: Dictionary defining the structure of generated ideas.\n\n#### `generate_idea`\n\n~~~python\ngenerate_idea() -> Dict\n~~~\n\n- Generates a new idea based on the configured parameters.\n- Returns a dictionary containing the generated idea.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.\n\nThe GitHub repository for this project can be found at: [https://github.com/yoheinakajima/idealist](https://github.com/yoheinakajima/idealist)\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A flexible Python library for generating and refining creative ideas using LLMs and embeddings.",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/yoheinakajima/infinite-idealist"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ca0464e4994aaaba70b4e1f12532eaa965dd866905028536b405a5c1be6de73f",
"md5": "e77357479b275410523217d10b8a200d",
"sha256": "d92d432cac3704c7e101bef684b81abb6b27e3d7af54cbc80eeae6f2289288f8"
},
"downloads": -1,
"filename": "infinite_idealist-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e77357479b275410523217d10b8a200d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 9135,
"upload_time": "2024-12-12T22:25:05",
"upload_time_iso_8601": "2024-12-12T22:25:05.207240Z",
"url": "https://files.pythonhosted.org/packages/ca/04/64e4994aaaba70b4e1f12532eaa965dd866905028536b405a5c1be6de73f/infinite_idealist-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "523bb7359484fc85a1116b769bd321b477ff32fce6d0e8c1aa6faec99be8e6e8",
"md5": "f72a9e329dda0b9c49bb7ae8d863b541",
"sha256": "619a18b878c661caf23aba0ac8ea96e8c7bc27670b0dac9f6263fc9fba30dbd4"
},
"downloads": -1,
"filename": "infinite_idealist-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "f72a9e329dda0b9c49bb7ae8d863b541",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 9844,
"upload_time": "2024-12-12T22:25:07",
"upload_time_iso_8601": "2024-12-12T22:25:07.716106Z",
"url": "https://files.pythonhosted.org/packages/52/3b/b7359484fc85a1116b769bd321b477ff32fce6d0e8c1aa6faec99be8e6e8/infinite_idealist-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-12 22:25:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yoheinakajima",
"github_project": "infinite-idealist",
"github_not_found": true,
"lcname": "infinite-idealist"
}