Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/elixir-denario-ex.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Elixir DenarioEx CI

on:
push:
paths:
- ".github/workflows/elixir-denario-ex.yml"
- "elixir/denario_ex/**"
pull_request:
paths:
- ".github/workflows/elixir-denario-ex.yml"
- "elixir/denario_ex/**"

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: elixir/denario_ex

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Erlang and Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: "1.18.4"
otp-version: "28.0"

- name: Restore Mix cache
uses: actions/cache@v4
with:
path: |
~/.mix
~/.hex
elixir/denario_ex/deps
elixir/denario_ex/_build
key: ${{ runner.os }}-elixir-denario-ex-${{ hashFiles('elixir/denario_ex/mix.lock') }}
restore-keys: |
${{ runner.os }}-elixir-denario-ex-

- name: Install dependencies
run: mix deps.get

- name: Run tests
run: mix test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ eggs/
.eggs/
lib/
lib64/
!elixir/denario_ex/lib/
!elixir/denario_ex/lib/**
parts/
sdist/
var/
Expand Down Expand Up @@ -73,6 +75,7 @@ cover/

# Django stuff:
*.log
erl_crash.dump
local_settings.py
db.sqlite3
db.sqlite3-journal
Expand Down
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,28 @@ Generate a research idea from that data specification.
den.get_idea()
```

Optionally, give Denario a short researcher statement so the paper-writing stages preserve your framing and priorities rather than defaulting only to generic scientific tone.

```python
den.set_researcher_statement(
"Emphasize robustness and measurement limits. Do not overclaim causality."
)
```

If you want to compare multiple directions before converging, generate candidate branches and build a comparison template:

```python
den.generate_idea_branches(count=3)
den.build_idea_comparison(
criteria=[
"Novelty",
"Feasibility with this dataset",
"Fit to the intended paper contribution",
]
)
den.select_idea_candidate(2)
```

Generate the methodology required for working on that idea.

```python
Expand All @@ -96,6 +118,14 @@ With the methodology setup, perform the required computations and get the plots
den.get_results()
```

Before paper generation, Denario now requires explicit human sign-off that the generated artifacts were reviewed and that a human accepts authorship responsibility.

```python
den.confirm_authorship(
"I checked the claims against the results, reviewed the citations, and rewrote the sections I will stand behind."
)
```

Finally, generate a latex article with the results. You can specify the journal style, in this example we choose the [APS (Physical Review Journals)](https://journals.aps.org/) style.

```python
Expand All @@ -110,6 +140,10 @@ You can also manually provide any info as a string or markdown file in an interm
den.set_method(path_to_the_method_file.md)
```

You can also provide a `researcher_statement.md` artifact through `set_researcher_statement(...)` if you want the paper-writing stages to preserve a particular stance, emphasis, or constraint.

Similarly, `generate_idea_branches(...)`, `generate_method_branches(...)`, `build_idea_comparison(...)`, `build_method_comparison(...)`, `select_idea_candidate(...)`, and `select_method_candidate(...)` support a compare-before-converge workflow.

## DenarioApp

You can run Denario using a GUI through the [DenarioApp](https://github.com/AstroPilot-AI/DenarioApp).
Expand Down
7 changes: 6 additions & 1 deletion denario/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from ._compat import patch_mistralai_for_cmbagent

patch_mistralai_for_cmbagent()

from .denario import Denario, Research, Journal, LLM, models, KeyManager
from .config import REPO_DIR
from .exceptions import AuthorshipConfirmationError

__all__ = ['Denario', 'Research', 'Journal', 'REPO_DIR', 'LLM', "models", "KeyManager"]
__all__ = ['Denario', 'Research', 'Journal', 'REPO_DIR', 'LLM', "models", "KeyManager", "AuthorshipConfirmationError"]

from importlib.metadata import version, PackageNotFoundError

Expand Down
35 changes: 35 additions & 0 deletions denario/_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Compatibility helpers for third-party dependencies."""

from __future__ import annotations

import importlib


def patch_mistralai_for_cmbagent() -> None:
"""Expose legacy top-level Mistral symbols expected by ``cmbagent``.

``cmbagent`` imports ``Mistral`` and ``DocumentURLChunk`` from the top-level
``mistralai`` module, while newer ``mistralai`` releases place them under
nested modules. Patch those attributes in when needed so Denario keeps
working across both layouts.
"""

try:
mistralai = importlib.import_module("mistralai")
except Exception:
return

try:
if not hasattr(mistralai, "Mistral"):
mistral_sdk = importlib.import_module("mistralai.client.sdk")
mistralai.Mistral = mistral_sdk.Mistral

if not hasattr(mistralai, "DocumentURLChunk"):
document_module = importlib.import_module(
"mistralai.client.models.documenturlchunk"
)
mistralai.DocumentURLChunk = document_module.DocumentURLChunk
except Exception:
# Leave the environment unchanged if the dependency moves again;
# downstream imports will surface the real error in that case.
return
7 changes: 7 additions & 0 deletions denario/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@
PAPER_FOLDER = "paper"

DESCRIPTION_FILE = "data_description.md"
RESEARCHER_STATEMENT_FILE = "researcher_statement.md"
IDEA_FILE = "idea.md"
IDEA_CANDIDATES_FILE = "idea_candidates.md"
IDEA_COMPARISON_FILE = "idea_comparison.md"
METHOD_FILE = "methods.md"
METHOD_CANDIDATES_FILE = "method_candidates.md"
METHOD_COMPARISON_FILE = "method_comparison.md"
RESULTS_FILE = "results.md"
LITERATURE_FILE = "literature.md"
REFEREE_FILE = "referee.md"
AUTHORSHIP_CONFIRMATION_FILE = "authorship_confirmation.md"
BRANCH_WORKSPACES_DIR = "branch_workspaces"
Loading