Skip to main content

Cognify logo

| Quickstart | Documentation | Blog | Discord | Send Feedback |

Automated, Multi-Faceted Gen-AI Workflow Optimization

Building high-quality, cost-effective generative-AI (gen-AI) applications is challenging due to the absence of systematic methods for tuning, testing, and optimizing them. We introduce Cognify, a tool that automatically enhances generation quality and reduces costs for gen-AI workflows, including those written with LangChain, DSPy, and annotated Python. Built on a novel foundation of hierarchical, workflow-level optimization, Cognify improves gen-AI workflow generation quality by up to 48% and reduces their execution cost by up to 9 times. Read more about Cognify here.

Installation

Cognify is available as a Python package and can be installed as

pip install cognify-ai

Or install from the source:

git clone https://github.com/GenseeAI/cognify
cd cognify
pip install -e .

Getting Started

You can use Cognify with our simple CLI:

cognify optimize /your/gen/ai/workflow.py   

where workflow.py is your workflow source code. Cognify currently supports unmodified LangChain and DSPy workflow source code. You can also port your existing workflow written directly on Python or develop new Python-based workflows with our simple workflow interface.

Cognify automatically searches for a config.py in the same folder as the workflow. You can also specify this file explicitly by:

cognify optimize /your/gen/ai/workflow.py -c /your/gen/ai/custom_config.py

Within the config.py, you should define the following:

  • Sample Dataset: Cognify relies on training data to evaluate and improve its workflow optimization. You should provide a data loader that loads your training dataset in the form of input-output pairs. Read more about how to load your data.
  • Evaluator: Cognify expects you to provide an evaluator for judging the final workflow generation's quality. To help you get started, Cognify provides several common evaluator implementations such as the F1 score. Find out more about workflow evaluator.
  • Optimization Configurations and Model Set Selection: Optionally, you can configure your optimization process in various ways. For example, you can choose between light, medium, or heavy search over the optimization space. We also provide a few domain-specific optimization configurations. You can also define the set of models you want Cognify to explore. If no configurations or models are provided, Cognify uses a default set of values. Read more about optimization configurations and model selections.

With these parameters, Cognify optimizes your workflow by iteratively experimenting with various combinations of tuning methods (we call them “cogs”) applied across workflow components and assessing the effectiveness of these combinations based on the quality of the final output using the user-provided sample dataset and evaluator. This process continues until Cognify hits the user-specified maximum iteration numbers (in config.py).

The result of this process is a set of optimized workflow versions with different quality-cost combinations on the Pareto frontier among all the iterations. You can inspect the optimizations applied in these output files You can evaluate these optimized versions with a test dataset:

cognify evaluate /your/gen/ai/workflow/optimization/output/path

You can also continue running Cognify with more iterations from these outputs using the -r or --resume flag:

cognify optimize /your/gen/ai/workflow.py -r

Follow our quickstart or read our full documentation to learn more.

Tell us how you use Cognify!

Metadata

Release files for cognify-ai 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cognify-ai 0.1.2
File Size Uploaded Provenance Actions
cognify_ai-0.1.2.tar.gz 108.3 kB Without provenance Details for cognify_ai-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cognify-ai 0.1.2
File Interpreter ABI Platform Actions
cognify_ai-0.1.2-py3-none-any.whl Python 3 none any Details for cognify_ai-0.1.2-py3-none-any.whl

Total release size: 244.7 kB

Release files / cognify_ai-0.1.2.tar.gz

Download URL cognify_ai-0.1.2.tar.gz
Size 108.3 kB
Tags Source
SHA-256 checksum
How to use checksums
439b0e6a558e8cb0ba84b13be4d5f41dd57d2931830ce4cac8daee13abbfd4da
BLAKE2b-256 checksum
How to use checksums
d477c4577aa03e62aee63e482b9fd7c54d5d02af973dbeeefc913746c86638ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.13

Release files / cognify_ai-0.1.2-py3-none-any.whl

Download URL cognify_ai-0.1.2-py3-none-any.whl
Size 136.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e6a377d800788d1db50c124dd319bd3505ced986a7bc3eae99c0d79ebb637c9
BLAKE2b-256 checksum
How to use checksums
b7750772235a4d770af385389b35de581ad58db779f814957c4accf429741784
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.13

Security for cognify-ai 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page