product-blurb 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- product_blurb-0.1.0/PKG-INFO +47 -0
- product_blurb-0.1.0/README.md +36 -0
- product_blurb-0.1.0/pyproject.toml +22 -0
- product_blurb-0.1.0/setup.cfg +4 -0
- product_blurb-0.1.0/src/product_blurb/__init__.py +62 -0
- product_blurb-0.1.0/src/product_blurb/cli.py +33 -0
- product_blurb-0.1.0/src/product_blurb.egg-info/PKG-INFO +47 -0
- product_blurb-0.1.0/src/product_blurb.egg-info/SOURCES.txt +10 -0
- product_blurb-0.1.0/src/product_blurb.egg-info/dependency_links.txt +1 -0
- product_blurb-0.1.0/src/product_blurb.egg-info/entry_points.txt +2 -0
- product_blurb-0.1.0/src/product_blurb.egg-info/requires.txt +1 -0
- product_blurb-0.1.0/src/product_blurb.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: product-blurb
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Rewrite product titles and descriptions into clean ecommerce listings using OpenAI.
|
|
5
|
+
Author: Paul
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: ecommerce,openai,product,description,copywriting,listing
|
|
8
|
+
Requires-Python: >=3.8
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: openai>=1.0.0
|
|
11
|
+
|
|
12
|
+
# product-blurb
|
|
13
|
+
|
|
14
|
+
Rewrite product titles and descriptions into clean, appealing ecommerce listings using OpenAI. It never invents specs, dimensions, materials, or features — it only rewrites what's already there, and strips brand/store names.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install product-blurb
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Setup
|
|
23
|
+
|
|
24
|
+
Set your OpenAI API key in the environment:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
export OPENAI_API_KEY="sk-..."
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Use as a library
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from product_blurb import generate
|
|
34
|
+
|
|
35
|
+
result = generate("Vintage Gothic Pocket Watch", "old style watch bronze chain steampunk")
|
|
36
|
+
# {"title": "...", "description": "..."}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Use from the command line
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
product-blurb --title "Vintage Gothic Pocket Watch" --description "old style watch bronze chain steampunk"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Outputs JSON: `{"title": "...", "description": "..."}`
|
|
46
|
+
|
|
47
|
+
Optional `--model` flag (default `gpt-5-mini`).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# product-blurb
|
|
2
|
+
|
|
3
|
+
Rewrite product titles and descriptions into clean, appealing ecommerce listings using OpenAI. It never invents specs, dimensions, materials, or features — it only rewrites what's already there, and strips brand/store names.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install product-blurb
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
Set your OpenAI API key in the environment:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
export OPENAI_API_KEY="sk-..."
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Use as a library
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from product_blurb import generate
|
|
23
|
+
|
|
24
|
+
result = generate("Vintage Gothic Pocket Watch", "old style watch bronze chain steampunk")
|
|
25
|
+
# {"title": "...", "description": "..."}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Use from the command line
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
product-blurb --title "Vintage Gothic Pocket Watch" --description "old style watch bronze chain steampunk"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Outputs JSON: `{"title": "...", "description": "..."}`
|
|
35
|
+
|
|
36
|
+
Optional `--model` flag (default `gpt-5-mini`).
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "product-blurb"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Rewrite product titles and descriptions into clean ecommerce listings using OpenAI."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "Paul" }]
|
|
13
|
+
keywords = ["ecommerce", "openai", "product", "description", "copywriting", "listing"]
|
|
14
|
+
dependencies = [
|
|
15
|
+
"openai>=1.0.0",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[project.scripts]
|
|
19
|
+
product-blurb = "product_blurb.cli:main"
|
|
20
|
+
|
|
21
|
+
[tool.setuptools.packages.find]
|
|
22
|
+
where = ["src"]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import json
|
|
3
|
+
from functools import lru_cache
|
|
4
|
+
|
|
5
|
+
from openai import OpenAI
|
|
6
|
+
|
|
7
|
+
__version__ = "0.1.0"
|
|
8
|
+
|
|
9
|
+
SYSTEM_PROMPT = (
|
|
10
|
+
"You are an expert ecommerce copywriter. "
|
|
11
|
+
"Rewrite product listings into engaging marketing copy. "
|
|
12
|
+
"Never invent product specifications, dimensions, materials, "
|
|
13
|
+
"compatibility, or features. Only rewrite what is already present. "
|
|
14
|
+
"Do not mention brand names or store names."
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@lru_cache(maxsize=1)
|
|
19
|
+
def _get_client():
|
|
20
|
+
"""Create the OpenAI client lazily so importing the package never
|
|
21
|
+
requires a key — only calling generate() does."""
|
|
22
|
+
key = os.getenv("OPENAI_API_KEY")
|
|
23
|
+
if not key:
|
|
24
|
+
raise RuntimeError(
|
|
25
|
+
"OPENAI_API_KEY is not set. Export it in your environment before calling generate()."
|
|
26
|
+
)
|
|
27
|
+
return OpenAI(api_key=key)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def generate(title, description, model="gpt-5-mini"):
|
|
31
|
+
"""Rewrite a product title + description into a clean listing.
|
|
32
|
+
|
|
33
|
+
Returns a dict: {"title": str, "description": str}
|
|
34
|
+
"""
|
|
35
|
+
client = _get_client()
|
|
36
|
+
|
|
37
|
+
response = client.responses.create(
|
|
38
|
+
model=model,
|
|
39
|
+
input=[
|
|
40
|
+
{"role": "system", "content": SYSTEM_PROMPT},
|
|
41
|
+
{
|
|
42
|
+
"role": "user",
|
|
43
|
+
"content": f"Title:\n{title}\n\nDescription:\n{description}",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
text={
|
|
47
|
+
"format": {
|
|
48
|
+
"type": "json_schema",
|
|
49
|
+
"name": "product_description",
|
|
50
|
+
"schema": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"properties": {
|
|
53
|
+
"title": {"type": "string"},
|
|
54
|
+
"description": {"type": "string"},
|
|
55
|
+
},
|
|
56
|
+
"required": ["title", "description"],
|
|
57
|
+
"additionalProperties": False,
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
)
|
|
62
|
+
return json.loads(response.output_text)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import json
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
from . import generate, __version__
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main():
|
|
9
|
+
parser = argparse.ArgumentParser(
|
|
10
|
+
prog="product-blurb",
|
|
11
|
+
description="Rewrite a product title + description into a clean ecommerce listing.",
|
|
12
|
+
)
|
|
13
|
+
parser.add_argument("--title", dest="title", type=str, required=True, help="product title")
|
|
14
|
+
parser.add_argument(
|
|
15
|
+
"--description", dest="description", type=str, required=True, help="raw product description"
|
|
16
|
+
)
|
|
17
|
+
parser.add_argument(
|
|
18
|
+
"--model", dest="model", type=str, default="gpt-5-mini", help="OpenAI model (default: gpt-5-mini)"
|
|
19
|
+
)
|
|
20
|
+
parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
|
|
21
|
+
args = parser.parse_args()
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
result = generate(args.title, args.description, model=args.model)
|
|
25
|
+
except Exception as e:
|
|
26
|
+
print(f"error: {e}", file=sys.stderr)
|
|
27
|
+
sys.exit(1)
|
|
28
|
+
|
|
29
|
+
print(json.dumps(result))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
if __name__ == "__main__":
|
|
33
|
+
main()
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: product-blurb
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Rewrite product titles and descriptions into clean ecommerce listings using OpenAI.
|
|
5
|
+
Author: Paul
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: ecommerce,openai,product,description,copywriting,listing
|
|
8
|
+
Requires-Python: >=3.8
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: openai>=1.0.0
|
|
11
|
+
|
|
12
|
+
# product-blurb
|
|
13
|
+
|
|
14
|
+
Rewrite product titles and descriptions into clean, appealing ecommerce listings using OpenAI. It never invents specs, dimensions, materials, or features — it only rewrites what's already there, and strips brand/store names.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install product-blurb
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Setup
|
|
23
|
+
|
|
24
|
+
Set your OpenAI API key in the environment:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
export OPENAI_API_KEY="sk-..."
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Use as a library
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from product_blurb import generate
|
|
34
|
+
|
|
35
|
+
result = generate("Vintage Gothic Pocket Watch", "old style watch bronze chain steampunk")
|
|
36
|
+
# {"title": "...", "description": "..."}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Use from the command line
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
product-blurb --title "Vintage Gothic Pocket Watch" --description "old style watch bronze chain steampunk"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Outputs JSON: `{"title": "...", "description": "..."}`
|
|
46
|
+
|
|
47
|
+
Optional `--model` flag (default `gpt-5-mini`).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/product_blurb/__init__.py
|
|
4
|
+
src/product_blurb/cli.py
|
|
5
|
+
src/product_blurb.egg-info/PKG-INFO
|
|
6
|
+
src/product_blurb.egg-info/SOURCES.txt
|
|
7
|
+
src/product_blurb.egg-info/dependency_links.txt
|
|
8
|
+
src/product_blurb.egg-info/entry_points.txt
|
|
9
|
+
src/product_blurb.egg-info/requires.txt
|
|
10
|
+
src/product_blurb.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
openai>=1.0.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
product_blurb
|