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
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,13 @@ To generate a *README.md* file, use the `readmeai` command in your terminal, alo

| Short Flag | Long Flag | Description | Status |
|------------|----------------|---------------------------------------------------|--------------|
| `-k` | `--api-key` | Your OpenAI API key. | Required |
| `-o` | `--output` | The output path for your README.md file. | Required |
| `-k` | `--api-key` | Your OpenAI API secret key. | Required |
| `-e` | `--engine` | OpenAI GPT language model engine (gpt-3.5-turbo) | Optional |
| `-o` | `--output` | The output path for your README.md file. | Optional |
| `-r` | `--repository` | The URL or path to your code repository. | Required |
| `-t` | `--template` | The README template format to use. (coming soon!) | Coming Soon! |
| `-t` | `--temperature`| The temperature (randomness) of the model | Optional |
| `-l` | `--language` | The language of text written in the README file. | Coming Soon! |
| `-s` | `--style` | The README template format to use. (coming soon!) | Coming Soon! |

<br>

Expand Down
22 changes: 21 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "readmeai"
version = "0.3.067"
version = "0.3.068"
description = "🚀 Generate beautiful README files automatically, powered by GPT-4 🪐"
authors = ["Eli <0x.eli.64s@gmail.com>"]
license = "MIT"
Expand All @@ -26,6 +26,7 @@ keywords = [
'openai-api',
'python',
'readme',
'readme-badges',
'readme-generation',
'readme-generator'
]
Expand All @@ -50,6 +51,7 @@ tiktoken = "^0.4.0"
toml = "^0.10.2"
pydantic = "^1.10.9"
click = "^8.1.6"
tornado = "^6.3.3"

[tool.poetry.dev-dependencies]
black = "*"
Expand Down
39 changes: 30 additions & 9 deletions readmeai/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@
config_helper = conf.load_config_helper(config_model)


async def main(output: str, repository: str) -> None:
async def main(repository: str) -> None:
"""Main entrypoint for the readme-ai application."""
config.git = conf.GitConfig(repository=repository)
config.paths.readme = output
logger.info("Model: %s", dict(config.api, api_key="*" * 16))
logger.info("Repository: %s", config.git)
llm = model.OpenAIHandler(config)
await generate_readme(llm)

Expand Down Expand Up @@ -97,6 +94,12 @@ def get_dependencies(
default=os.environ.get("OPENAI_API_KEY", None),
help="OpenAI API secret key.",
)
@click.option(
"-e",
"--engine",
default="gpt-3.5-turbo",
help="OpenAI language model engine to use.",
)
@click.option(
"-o",
"--output",
Expand All @@ -111,24 +114,42 @@ def get_dependencies(
)
@click.option(
"-t",
"--template",
help="Template to use for README.md file.",
"--temperature",
default=0.9,
help="OpenAI's temperature parameter, a higher value increases randomness.",
)
@click.option(
"-l",
"--language",
help="Language to write README.md file in.",
)
@click.option(
"-s",
"--style",
help="Template to use for README.md file.",
)
def cli(
api_key: str,
output: str,
engine: Optional[str],
output: Optional[str],
repository: str,
template: Optional[int],
temperature: Optional[float],
language: Optional[str],
style: Optional[int],
) -> None:
"""Cli entrypoint for readme-ai pypi package."""
config.paths.readme = output
config.api.api_key = api_key
config.api.engine = engine
config.api.temperature = temperature

logger.info("README-AI is now executing.")
asyncio.run(main(output, repository))
logger.info(f"Output file: {config.paths.readme}")
logger.info(f"OpenAI Engine: {config.api.engine}")
logger.info(f"OpenAI Temperature: {config.api.temperature}")

asyncio.run(main(repository))

logger.info("README-AI execution complete.")


Expand Down