Skip to content
Merged
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*egg-info/
*.egg-info/
*.vcd
__pycache__/
key.cfg
Expand All @@ -10,3 +10,5 @@ data/
*.o
*.d
*.vvp
dist/
build/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "verilog-eval"]
path = verilog-eval
url = https://github.com/NVlabs/verilog-eval
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ MAGE is an open-source multi-agent LLM RTL code generator.
### 1.> To install the repo itself:
```
git clone https://github.com/stable-lab/MAGE.git
# To get submodules at the same time
git clone --recursive https://github.com/stable-lab/MAGE.git
cd MAGE

# Install conda first if it's not on your machine like "apt install conda"
# To confirm successful installation of conda, run "conda --version"
# Continue after successfully installed conda
conda create -n mage python=3.11
conda activate mage
pip install -Ue .
pip install .
```

### 2.>To set api key:
Expand All @@ -26,10 +28,10 @@ You can either:
2. Create key.cfg file. The file should be in format of:

```
OPENAI_API_KEY: 'xxxxxxx'
ANTHROPIC_API_KEY: 'xxxxxxx'
VERTEX_SERVICE_ACCOUNT_PATH: 'xxxxxxx'
VERTEX_REGION: 'xxxxxxx'
OPENAI_API_KEY= 'xxxxxxx'
ANTHROPIC_API_KEY= 'xxxxxxx'
VERTEX_SERVICE_ACCOUNT_PATH= 'xxxxxxx'
VERTEX_REGION= 'xxxxxxx'
```

### To install iverilog {.tabset}
Expand Down Expand Up @@ -97,7 +99,7 @@ python3 setup.py install --user
```

```
git clone https://github.com/NVlabs/verilog-eval
git submodule update -- init -- recursive
```

## File structure
Expand Down Expand Up @@ -153,7 +155,7 @@ args_dict = {
"top_p": 0.95,
"max_token": 8192,
"use_golden_tb_in_mage": True,
"key_cfg_path": os.path.join(os.path.dirname(os.path.abspath(__file__)), "key.cfg"),
"key_cfg_path": "key.cfg",
}
```
Where each argument means:
Expand All @@ -167,7 +169,7 @@ Where each argument means:
8. temperature: Argument for LLM generation randomness. Usually between [0, 1]
9. top_p: Argument for LLM generation randomness. Usually between [0, 1]
10. max_token: Maximum number of tokens the model is allowed to generate in its output.
11. key_cfg_path: Path to your key.cfg file. Defaulted to be under MAGE/tests
11. key_cfg_path: Path to your key.cfg file. Defaulted to be under MAGE


## Development Guide
Expand Down
38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "mage"
version = "1.0.1"
description = "MAGE: Open-source multi-agent LLM RTL code generator"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
dependencies = [
"config",
"fsspec[http]<=2024.9.0,>=2023.1.0",
"httpx<1,>=0.23.0",
"llama-index-core",
"llama-index-llms-anthropic",
"llama-index-llms-openai",
"llama-index-llms-vertex",
"pre-commit",
"pydantic",
"rich",
"tiktoken"
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX",
"Programming Language :: Python :: 3"
]

[tool.setuptools]
include-package-data = true
zip-safe = false
packages = ["mage"]

[tool.setuptools.package-dir]
mage = "src/mage_rtl"
9 changes: 0 additions & 9 deletions requirements.txt

This file was deleted.

43 changes: 0 additions & 43 deletions setup.py

This file was deleted.

Empty file added src/mage_rtl/__init__.py
Empty file.
1 change: 1 addition & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
output_*
19 changes: 15 additions & 4 deletions tests/test_llm_chat.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
import argparse

from mage_rtl.gen_config import Config, get_llm
from mage_rtl.log_utils import get_logger
from mage.gen_config import Config, get_llm
from mage.log_utils import get_logger

logger = get_logger(__name__)

args_dict = {
"model": "claude-3-5-sonnet-20241022",
"provider": "anthropic",
}


def main():
args = argparse.Namespace(**args_dict)
cfg = Config("./key.cfg")
get_llm(model=args.model, api_key=cfg["ANTHROPIC_API_KEY"], max_tokens=8192)
get_llm(model="gpt-4o", api_key=cfg["OPENAI_API_KEY"], max_tokens=8192)
get_llm(
model=args.model,
api_key=cfg["ANTHROPIC_API_KEY"],
max_tokens=8192,
cfg_path="./key.cfg",
)
get_llm(
model="gpt-4o",
api_key=cfg["OPENAI_API_KEY"],
max_tokens=8192,
cfg_path="./key.cfg",
)


if __name__ == "__main__":
Expand Down
8 changes: 4 additions & 4 deletions tests/test_rtl_generator.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import argparse

from mage_rtl.benchmark_read_helper import (
from mage.benchmark_read_helper import (
TypeBenchmark,
TypeBenchmarkFile,
get_benchmark_contents,
)
from mage_rtl.gen_config import Config, get_llm
from mage_rtl.log_utils import get_logger
from mage_rtl.rtl_generator import RTLGenerator
from mage.gen_config import Config, get_llm
from mage.log_utils import get_logger
from mage.rtl_generator import RTLGenerator

logger = get_logger(__name__)

Expand Down
9 changes: 4 additions & 5 deletions tests/test_single_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
import backoff
import openai
import pandas as pd

from mage_rtl.benchmark_read_helper import (
from mage.benchmark_read_helper import (
TypeBenchmark,
TypeBenchmarkFile,
get_benchmark_contents,
)
from mage_rtl.gen_config import Config, get_llm
from mage_rtl.log_utils import get_logger
from mage_rtl.rtl_generator import RTLGenerator
from mage.gen_config import Config, get_llm
from mage.log_utils import get_logger
from mage.rtl_generator import RTLGenerator

# Configuration and Constants
# model = "gpt-4-0314"
Expand Down
15 changes: 7 additions & 8 deletions tests/test_top_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
from typing import Any, Dict

from llama_index.core.llms import LLM

from mage_rtl.agent import TopAgent
from mage_rtl.benchmark_read_helper import (
from mage.agent import TopAgent
from mage.benchmark_read_helper import (
TypeBenchmark,
TypeBenchmarkFile,
get_benchmark_contents,
)
from mage_rtl.gen_config import get_llm, set_exp_setting
from mage_rtl.log_utils import get_logger
from mage_rtl.sim_reviewer import sim_review_golden_benchmark
from mage_rtl.token_counter import TokenCount
from mage.gen_config import get_llm, set_exp_setting
from mage.log_utils import get_logger
from mage.sim_reviewer import sim_review_golden_benchmark
from mage.token_counter import TokenCount

logger = get_logger(__name__)

Expand All @@ -37,7 +36,7 @@
"top_p": 0.95,
"max_token": 8192,
"use_golden_tb_in_mage": True,
"key_cfg_path": "./key.cfg",
"key_cfg_path": "../key.cfg",
}


Expand Down
1 change: 1 addition & 0 deletions verilog-eval
Submodule verilog-eval added at c49822