aigifmaker-haystack 0.1.0__py3-none-any.whl
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.
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""AI GIF Maker as a Haystack component.
|
|
2
|
+
|
|
3
|
+
AI GIF Maker (https://aigifmaker.ai) turns text into animated GIFs with native
|
|
4
|
+
GIF generation, no video conversion. The component runs on an AI GIF Maker
|
|
5
|
+
account: pass ``api_key`` (a Haystack ``Secret``) or set ``AIGIFMAKER_API_KEY``.
|
|
6
|
+
Create a key at https://aigifmaker.ai/settings/apikeys. Each GIF costs 1 credit
|
|
7
|
+
on that account, the same as on the website.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from typing import Any, Dict, List
|
|
11
|
+
|
|
12
|
+
import aigifmaker
|
|
13
|
+
from haystack import component, default_from_dict, default_to_dict
|
|
14
|
+
from haystack.utils import Secret, deserialize_secrets_inplace
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@component
|
|
18
|
+
class AigifmakerGifGenerator:
|
|
19
|
+
"""Turns a text prompt into an animated GIF and returns its URL.
|
|
20
|
+
|
|
21
|
+
Usage:
|
|
22
|
+
```python
|
|
23
|
+
from aigifmaker_haystack import AigifmakerGifGenerator
|
|
24
|
+
|
|
25
|
+
gen = AigifmakerGifGenerator() # reads AIGIFMAKER_API_KEY
|
|
26
|
+
gen.run(prompt="a corgi in sunglasses dancing on a beach, looping")["gifs"]
|
|
27
|
+
```
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init__(
|
|
31
|
+
self,
|
|
32
|
+
api_key: Secret = Secret.from_env_var("AIGIFMAKER_API_KEY", strict=False),
|
|
33
|
+
timeout: float = 900.0,
|
|
34
|
+
):
|
|
35
|
+
self.api_key = api_key
|
|
36
|
+
self.timeout = timeout
|
|
37
|
+
|
|
38
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
39
|
+
return default_to_dict(self, api_key=self.api_key.to_dict(), timeout=self.timeout)
|
|
40
|
+
|
|
41
|
+
@classmethod
|
|
42
|
+
def from_dict(cls, data: Dict[str, Any]) -> "AigifmakerGifGenerator":
|
|
43
|
+
deserialize_secrets_inplace(data["init_parameters"], keys=["api_key"])
|
|
44
|
+
return default_from_dict(cls, data)
|
|
45
|
+
|
|
46
|
+
@component.output_types(gifs=List[str])
|
|
47
|
+
def run(self, prompt: str) -> Dict[str, List[str]]:
|
|
48
|
+
"""Generate one GIF.
|
|
49
|
+
|
|
50
|
+
Raises an ``aigifmaker.AigifmakerError`` subclass (``AuthError``,
|
|
51
|
+
``QuotaError``, ``RejectedError``, ``GenerationFailed``) on a refusal,
|
|
52
|
+
an empty balance, a failed run or a timeout.
|
|
53
|
+
"""
|
|
54
|
+
url = aigifmaker.generate(prompt, api_key=self.api_key.resolve_value(), timeout=self.timeout)
|
|
55
|
+
return {"gifs": [url]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aigifmaker-haystack
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Haystack component for AI GIF Maker (aigifmaker.ai): turn text into animated GIFs in a pipeline
|
|
5
|
+
Project-URL: Homepage, https://aigifmaker.ai/?utm_source=pypi-haystack&utm_medium=package
|
|
6
|
+
Project-URL: Pricing, https://aigifmaker.ai/pricing
|
|
7
|
+
Project-URL: Documentation, https://aigifmaker.readthedocs.io/en/latest/
|
|
8
|
+
Project-URL: Source, https://github.com/hanshs474/aigifmaker-haystack
|
|
9
|
+
Author-email: AI GIF Maker <support@aigifmaker.ai>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: ai,aigifmaker,animated-gif,gif,gif-generator,haystack,pipeline,text-to-gif
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Requires-Dist: aigifmaker>=0.1.1
|
|
17
|
+
Requires-Dist: haystack-ai>=2.0
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# aigifmaker-haystack
|
|
21
|
+
|
|
22
|
+
Turn text into animated GIFs with AI GIF Maker. Native GIF generation — no video conversion. Type what you want and download your GIF in about a minute.
|
|
23
|
+
|
|
24
|
+
This is a [Haystack](https://haystack.deepset.ai) component for [AI GIF Maker](https://aigifmaker.ai/?utm_source=pypi-haystack&utm_medium=package): drop `AigifmakerGifGenerator` into a pipeline and every prompt comes out as a link to a finished `.gif`.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install aigifmaker-haystack
|
|
28
|
+
export AIGIFMAKER_API_KEY=sk-... # create one at https://aigifmaker.ai/settings/apikeys
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from aigifmaker_haystack import AigifmakerGifGenerator
|
|
33
|
+
|
|
34
|
+
AigifmakerGifGenerator().run(prompt="a corgi in sunglasses dancing on a beach, looping")
|
|
35
|
+
# {"gifs": ["https://.../....gif"]}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## In a pipeline
|
|
39
|
+
|
|
40
|
+
Let an LLM write the GIF idea, then render it:
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from haystack import Pipeline
|
|
44
|
+
from haystack.components.builders import PromptBuilder
|
|
45
|
+
from haystack.components.generators import OpenAIGenerator
|
|
46
|
+
from aigifmaker_haystack import AigifmakerGifGenerator
|
|
47
|
+
|
|
48
|
+
p = Pipeline()
|
|
49
|
+
p.add_component("brief", PromptBuilder("Write one short GIF prompt reacting to: {{message}}. Say what moves and that it loops."))
|
|
50
|
+
p.add_component("llm", OpenAIGenerator())
|
|
51
|
+
p.add_component("gif", AigifmakerGifGenerator())
|
|
52
|
+
p.connect("brief", "llm")
|
|
53
|
+
p.connect("llm.replies", "gif.prompt")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
(`llm.replies` is a list; add a small adapter component that takes `replies[0]` if your Haystack version does not convert it.)
|
|
57
|
+
|
|
58
|
+
## Component
|
|
59
|
+
|
|
60
|
+
`AigifmakerGifGenerator(api_key=Secret.from_env_var("AIGIFMAKER_API_KEY"), timeout=900.0)`
|
|
61
|
+
|
|
62
|
+
- Input: `prompt` (str), what the GIF shows and how it moves.
|
|
63
|
+
- Output: `gifs`, a list with one GIF URL.
|
|
64
|
+
- Serializes with `to_dict` / `from_dict`; the key stays a Haystack `Secret`.
|
|
65
|
+
- Errors come from the [`aigifmaker`](https://pypi.org/project/aigifmaker/) SDK: `AuthError` (no key or a wrong key), `QuotaError` (out of credits), `RejectedError` (the content filter refused; reword), `GenerationFailed` (the run failed and its credit was refunded).
|
|
66
|
+
|
|
67
|
+
## Cost
|
|
68
|
+
|
|
69
|
+
Each GIF costs 1 credit on your AI GIF Maker account, the same as on the website. New accounts get one free GIF (it carries a small aigifmaker.ai badge). Credit packs are on the [pricing](https://aigifmaker.ai/pricing?utm_source=pypi-haystack&utm_medium=package) page.
|
|
70
|
+
|
|
71
|
+
Questions: support@aigifmaker.ai. MIT licensed. Source: https://github.com/hanshs474/aigifmaker-haystack
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
aigifmaker_haystack/__init__.py,sha256=7TdQefz9nxiHiwOeYRPW9859V34ZaAkXPLTMNPMIWYs,216
|
|
2
|
+
aigifmaker_haystack/generators.py,sha256=2gpSPmY_ixch7dtR6OEqLMR2HzCYsd8S3vWy1IXizVk,2015
|
|
3
|
+
aigifmaker_haystack-0.1.0.dist-info/METADATA,sha256=nNO9KYLsnCR7iNyEfgKiMFTKxi9b66qd0CgkbBeqGhU,3272
|
|
4
|
+
aigifmaker_haystack-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
5
|
+
aigifmaker_haystack-0.1.0.dist-info/licenses/LICENSE,sha256=GDXpAv3-ST6EtIxLtWyHR8-pallbvHTxgvOYLSDi0zY,1093
|
|
6
|
+
aigifmaker_haystack-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AI GIF Maker (https://aigifmaker.ai)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|