llamagen-python 0.1.10__tar.gz → 0.1.12__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llamagen-python
3
- Version: 0.1.10
3
+ Version: 0.1.12
4
4
  Summary: Official Python SDK for LlamaGen Comic API and Animation API
5
5
  Project-URL: Homepage, https://llamagen.ai/comic-api
6
6
  Project-URL: Documentation, https://llamagen.ai/comic-api/docs
@@ -72,7 +72,7 @@ client = LlamaGenClient(
72
72
 
73
73
  created = client.comic.create({
74
74
  "prompt": "A 4-panel comic about Leo finding a glowing key in a quiet library.",
75
- "style": "manga",
75
+ "preset": "japanese_manga",
76
76
  "fixPanelNum": 4,
77
77
  })
78
78
  print("comic.create:", created["id"], created.get("status"))
@@ -119,14 +119,14 @@ client = LlamaGenClient(api_key=os.environ["LLAMAGEN_API_KEY"])
119
119
 
120
120
  generation = client.comic.create({
121
121
  "prompt": "The Little Prince meets the Fox in a luminous desert.",
122
- "style": "storybook manga",
122
+ "preset": "animeStyle",
123
123
  "size": "1024x1024",
124
124
  "pagination": {"totalPages": 2, "panelsPerPage": 4},
125
125
  "comicRoles": [
126
126
  {
127
127
  "name": "The Little Prince",
128
128
  "image": "https://example.com/prince.png",
129
- "clothing": "green coat and yellow scarf",
129
+ "dress": "green coat and yellow scarf",
130
130
  }
131
131
  ],
132
132
  "attachments": [{"type": "image", "url": "https://example.com/reference.png"}],
@@ -137,7 +137,7 @@ generation = client.comic.create({
137
137
 
138
138
  Comic methods:
139
139
 
140
- - `llamagen.comic.create(params)` submits a new comic generation job and returns the created job id, status, and usage metadata.
140
+ - `llamagen.comic.create(params)` submits a new comic generation job and returns the created job id, status, and usage metadata. Use `preset` for a known style preset id; keep `prompt` focused on story, characters, scene, and action.
141
141
  - `llamagen.comic.get(id, page=None, panel=None)` fetches a comic generation's status and result, or a specific page or panel.
142
142
  - `llamagen.comic.continue_write(id, params)` extends an existing comic.
143
143
  - `llamagen.comic.update_panel(id, params)` regenerates one panel.
@@ -159,7 +159,7 @@ client = LlamaGenClient(api_key=os.environ["LLAMAGEN_API_KEY"])
159
159
 
160
160
  created = client.comic.create({
161
161
  "prompt": "A 4-panel comic about Leo finding a glowing key in a quiet library.",
162
- "style": "manga",
162
+ "preset": "comicBookStyle",
163
163
  "fixPanelNum": 4,
164
164
  })
165
165
  print("comic.create:", created["id"], created.get("status"))
@@ -211,7 +211,7 @@ client = LlamaGenClient(api_key=os.environ["LLAMAGEN_API_KEY"])
211
211
 
212
212
  finished = client.comic.create_and_wait({
213
213
  "prompt": "A cozy 3-panel comic about a robot learning to bake bread.",
214
- "style": "storybook",
214
+ "preset": "comicBookStyle",
215
215
  "fixPanelNum": 3,
216
216
  }, timeout_ms=WAIT_TIMEOUT_MS)
217
217
  print("comic.create_and_wait:", finished["id"], finished.get("status"))
@@ -47,7 +47,7 @@ client = LlamaGenClient(
47
47
 
48
48
  created = client.comic.create({
49
49
  "prompt": "A 4-panel comic about Leo finding a glowing key in a quiet library.",
50
- "style": "manga",
50
+ "preset": "japanese_manga",
51
51
  "fixPanelNum": 4,
52
52
  })
53
53
  print("comic.create:", created["id"], created.get("status"))
@@ -94,14 +94,14 @@ client = LlamaGenClient(api_key=os.environ["LLAMAGEN_API_KEY"])
94
94
 
95
95
  generation = client.comic.create({
96
96
  "prompt": "The Little Prince meets the Fox in a luminous desert.",
97
- "style": "storybook manga",
97
+ "preset": "animeStyle",
98
98
  "size": "1024x1024",
99
99
  "pagination": {"totalPages": 2, "panelsPerPage": 4},
100
100
  "comicRoles": [
101
101
  {
102
102
  "name": "The Little Prince",
103
103
  "image": "https://example.com/prince.png",
104
- "clothing": "green coat and yellow scarf",
104
+ "dress": "green coat and yellow scarf",
105
105
  }
106
106
  ],
107
107
  "attachments": [{"type": "image", "url": "https://example.com/reference.png"}],
@@ -112,7 +112,7 @@ generation = client.comic.create({
112
112
 
113
113
  Comic methods:
114
114
 
115
- - `llamagen.comic.create(params)` submits a new comic generation job and returns the created job id, status, and usage metadata.
115
+ - `llamagen.comic.create(params)` submits a new comic generation job and returns the created job id, status, and usage metadata. Use `preset` for a known style preset id; keep `prompt` focused on story, characters, scene, and action.
116
116
  - `llamagen.comic.get(id, page=None, panel=None)` fetches a comic generation's status and result, or a specific page or panel.
117
117
  - `llamagen.comic.continue_write(id, params)` extends an existing comic.
118
118
  - `llamagen.comic.update_panel(id, params)` regenerates one panel.
@@ -134,7 +134,7 @@ client = LlamaGenClient(api_key=os.environ["LLAMAGEN_API_KEY"])
134
134
 
135
135
  created = client.comic.create({
136
136
  "prompt": "A 4-panel comic about Leo finding a glowing key in a quiet library.",
137
- "style": "manga",
137
+ "preset": "comicBookStyle",
138
138
  "fixPanelNum": 4,
139
139
  })
140
140
  print("comic.create:", created["id"], created.get("status"))
@@ -186,7 +186,7 @@ client = LlamaGenClient(api_key=os.environ["LLAMAGEN_API_KEY"])
186
186
 
187
187
  finished = client.comic.create_and_wait({
188
188
  "prompt": "A cozy 3-panel comic about a robot learning to bake bread.",
189
- "style": "storybook",
189
+ "preset": "comicBookStyle",
190
190
  "fixPanelNum": 3,
191
191
  }, timeout_ms=WAIT_TIMEOUT_MS)
192
192
  print("comic.create_and_wait:", finished["id"], finished.get("status"))
@@ -0,0 +1,96 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "1a448d8d-251a-4351-a830-0372b055fb65",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "comic.create: cmrfqxwsu0003l404hr39nmhm LOADING\n",
14
+ "comic.wait_for_completion: cmrfqxwsu0003l404hr39nmhm PROCESSED [{'page': 0, 'prompt': 'A 4-panel comic about Leo finding a glowing key in a quiet library.', 'beginPageIndex': 0, 'totalPages': 1, 'panelsPerPage': 4, 'layout': 'Layout0', 'panels': [{'assetUrl': 'https://s.llamagen.ai/clr907a8t0000jp08cgdqv78h/f521f8e4-abcd-4e1f-9e42-48f6b7a8715c.png', 'panel': 0, 'caption': 'Leo quietly browses the library shelves, lost in the peaceful atmosphere.', 'image': []}, {'assetUrl': 'https://s.llamagen.ai/clr907a8t0000jp08cgdqv78h/72b6b5f4-05bb-499e-9528-0c5b418b5eba.png', 'panel': 1, 'caption': 'Leo notices a faint glow beneath one of the lower shelves.', 'image': []}, {'assetUrl': 'https://s.llamagen.ai/clr907a8t0000jp08cgdqv78h/62e36e8c-0a74-4bc8-a44a-c3bbf9f880c7.png', 'panel': 2, 'caption': 'Leo carefully reaches under the shelf and retrieves the glowing key.', 'image': []}, {'assetUrl': 'https://s.llamagen.ai/clr907a8t0000jp08cgdqv78h/7ed32fee-379f-4f48-9880-1c06739ee240.png', 'panel': 3, 'caption': 'Leo gazes at the glowing key, his eyes full of wonder and imagination.', 'image': []}], 'update': 1783737031958, 'firstUpdate': 1783737031958}]\n"
15
+ ]
16
+ }
17
+ ],
18
+ "source": [
19
+ "import os\n",
20
+ "\n",
21
+ "from llamagen import LlamaGenClient\n",
22
+ "\n",
23
+ "WAIT_TIMEOUT_MS = 30 * 60 * 1000\n",
24
+ "\n",
25
+ "client = LlamaGenClient(\n",
26
+ " api_key=\"sk-5d609cd64379d048edcb04dcc109a6cfaf7c066f12138c13c8c404766ab9629d\",\n",
27
+ " timeout_ms=30000,\n",
28
+ " max_retries=5,\n",
29
+ " retry_delay_ms=500,\n",
30
+ ")\n",
31
+ "\n",
32
+ "created = client.comic.create({\n",
33
+ " \"prompt\": \"A 4-panel comic about Leo finding a glowing key in a quiet library.\",\n",
34
+ " \"style\": \"manga\",\n",
35
+ " \"fixPanelNum\": 4,\n",
36
+ "})\n",
37
+ "print(\"comic.create:\", created[\"id\"], created.get(\"status\"))\n",
38
+ "\n",
39
+ "done = client.comic.wait_for_completion(created[\"id\"], timeout_ms=WAIT_TIMEOUT_MS)\n",
40
+ "print(\"comic.wait_for_completion:\", done[\"id\"], done.get(\"status\"), done.get(\"comics\"))"
41
+ ]
42
+ },
43
+ {
44
+ "cell_type": "code",
45
+ "execution_count": null,
46
+ "id": "f0c6df20-22f8-410e-9920-691f2d9b6557",
47
+ "metadata": {},
48
+ "outputs": [],
49
+ "source": [
50
+ "import os\n",
51
+ "\n",
52
+ "from llamagen import LlamaGenClient\n",
53
+ "\n",
54
+ "client = LlamaGenClient(api_key=\"sk-5d609cd64379d048edcb04dcc109a6cfaf7c066f12138c13c8c404766ab9629d\")\n",
55
+ "\n",
56
+ "generation = client.comic.create({\n",
57
+ " \"prompt\": \"The Little Prince meets the Fox in a luminous desert.\",\n",
58
+ " \"style\": \"storybook manga\",\n",
59
+ " \"size\": \"1024x1024\",\n",
60
+ " \"pagination\": {\"totalPages\": 2, \"panelsPerPage\": 4},\n",
61
+ " \"comicRoles\": [\n",
62
+ " {\n",
63
+ " \"name\": \"The Little Prince\",\n",
64
+ " \"image\": \"https://example.com/prince.png\",\n",
65
+ " \"clothing\": \"green coat and yellow scarf\",\n",
66
+ " }\n",
67
+ " ],\n",
68
+ " \"attachments\": [{\"type\": \"image\", \"url\": \"https://example.com/reference.png\"}],\n",
69
+ " \"language\": \"en\",\n",
70
+ " \"upscale\": \"2K\",\n",
71
+ "})"
72
+ ]
73
+ }
74
+ ],
75
+ "metadata": {
76
+ "kernelspec": {
77
+ "display_name": "Python 3 (ipykernel)",
78
+ "language": "python",
79
+ "name": "python3"
80
+ },
81
+ "language_info": {
82
+ "codemirror_mode": {
83
+ "name": "ipython",
84
+ "version": 3
85
+ },
86
+ "file_extension": ".py",
87
+ "mimetype": "text/x-python",
88
+ "name": "python",
89
+ "nbconvert_exporter": "python",
90
+ "pygments_lexer": "ipython3",
91
+ "version": "3.12.7"
92
+ }
93
+ },
94
+ "nbformat": 4,
95
+ "nbformat_minor": 5
96
+ }
@@ -40,7 +40,7 @@ def quick_start(client: LlamaGenClient) -> None:
40
40
  created = client.comic.create(
41
41
  {
42
42
  "prompt": "A 4-panel comic about Leo finding a glowing key in a quiet library.",
43
- "style": "manga",
43
+ "preset": "japanese_manga",
44
44
  "fixPanelNum": 4,
45
45
  }
46
46
  )
@@ -54,7 +54,7 @@ def create_comic(client: LlamaGenClient) -> None:
54
54
  created = client.comic.create(
55
55
  {
56
56
  "prompt": "A 4-panel comic about Leo finding a glowing key in a quiet library.",
57
- "style": "manga",
57
+ "preset": "comicBookStyle",
58
58
  "fixPanelNum": 4,
59
59
  }
60
60
  )
@@ -65,14 +65,14 @@ def create_comic_with_advanced_options(client: LlamaGenClient) -> None:
65
65
  generation = client.comic.create(
66
66
  {
67
67
  "prompt": "The Little Prince meets the Fox in a luminous desert.",
68
- "style": "storybook manga",
68
+ "preset": "animeStyle",
69
69
  "size": "1024x1024",
70
70
  "pagination": {"totalPages": 2, "panelsPerPage": 4},
71
71
  "comicRoles": [
72
72
  {
73
73
  "name": "The Little Prince",
74
74
  "image": "https://example.com/prince.png",
75
- "clothing": "green coat and yellow scarf",
75
+ "dress": "green coat and yellow scarf",
76
76
  }
77
77
  ],
78
78
  "attachments": [{"type": "image", "url": "https://example.com/reference.png"}],
@@ -100,7 +100,7 @@ def create_and_wait_for_comic(client: LlamaGenClient) -> None:
100
100
  finished = client.comic.create_and_wait(
101
101
  {
102
102
  "prompt": "A cozy 3-panel comic about a robot learning to bake bread.",
103
- "style": "storybook",
103
+ "preset": "comicBookStyle",
104
104
  "fixPanelNum": 3,
105
105
  },
106
106
  timeout_ms=WAIT_TIMEOUT_MS,
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "llamagen-python"
7
- version = "0.1.10"
7
+ version = "0.1.12"
8
8
  description = "Official Python SDK for LlamaGen Comic API and Animation API"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -14,4 +14,4 @@ __all__ = [
14
14
  "SUPPORTED_COMIC_SIZES",
15
15
  ]
16
16
 
17
- __version__ = "0.1.10"
17
+ __version__ = "0.1.12"
@@ -10,7 +10,7 @@ from typing import Any, Dict, Mapping, Optional, Protocol, Tuple
10
10
 
11
11
  from ._errors import LlamaGenAPIError, LlamaGenConnectionError, LlamaGenTimeoutError
12
12
 
13
- DEFAULT_USER_AGENT = "llamagen-python/0.1.10"
13
+ DEFAULT_USER_AGENT = "llamagen-python/0.1.12"
14
14
 
15
15
 
16
16
  class Transport(Protocol):
@@ -29,8 +29,7 @@ class ComicRole(TypedDict, total=False):
29
29
  image: str
30
30
  age: Union[int, str]
31
31
  gender: str
32
- clothing: str
33
- description: str
32
+ dress: str
34
33
 
35
34
 
36
35
  class ComicLocation(TypedDict, total=False):
@@ -49,11 +48,9 @@ class CreateComicParams(TypedDict, total=False):
49
48
  size: str
50
49
  model: str
51
50
  preset: str
52
- style: str
53
51
  promptUrl: str
54
52
  fixPanelNum: int
55
53
  pagination: ComicPagination
56
- images: List[str]
57
54
  comicRoles: List[ComicRole]
58
55
  comicLocations: List[ComicLocation]
59
56
  attachments: List[ComicAttachment]
@@ -66,7 +63,6 @@ class ContinueComicParams(TypedDict, total=False):
66
63
  fixPanelNum: int
67
64
  pagination: ComicPagination
68
65
  attachments: List[ComicAttachment]
69
- images: List[str]
70
66
 
71
67
 
72
68
  class UpdateComicPanelParams(TypedDict, total=False):
@@ -80,7 +80,7 @@ class ClientTests(unittest.TestCase):
80
80
  self.assertEqual(call["url"], "https://api.llamagen.ai/v1/comics/generations")
81
81
  self.assertEqual(call["headers"]["Authorization"], "Bearer test-key")
82
82
  self.assertEqual(call["headers"]["Accept"], "application/json")
83
- self.assertEqual(call["headers"]["User-Agent"], "llamagen-python/0.1.10")
83
+ self.assertEqual(call["headers"]["User-Agent"], "llamagen-python/0.1.12")
84
84
  body = json.loads(call["body"].decode("utf-8"))
85
85
  self.assertEqual(body["preset"], "neutral")
86
86
  self.assertEqual(body["size"], "1024x1024")