Python-Pollinations-AI 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.
- python_pollinations_ai-0.1.0/PKG-INFO +58 -0
- python_pollinations_ai-0.1.0/Python-Pollinations-AI/__init__.py +19 -0
- python_pollinations_ai-0.1.0/Python-Pollinations-AI/core.py +62 -0
- python_pollinations_ai-0.1.0/Python_Pollinations_AI.egg-info/PKG-INFO +58 -0
- python_pollinations_ai-0.1.0/Python_Pollinations_AI.egg-info/SOURCES.txt +9 -0
- python_pollinations_ai-0.1.0/Python_Pollinations_AI.egg-info/dependency_links.txt +1 -0
- python_pollinations_ai-0.1.0/Python_Pollinations_AI.egg-info/requires.txt +1 -0
- python_pollinations_ai-0.1.0/Python_Pollinations_AI.egg-info/top_level.txt +1 -0
- python_pollinations_ai-0.1.0/README.md +41 -0
- python_pollinations_ai-0.1.0/setup.cfg +4 -0
- python_pollinations_ai-0.1.0/setup.py +19 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Python-Pollinations-AI
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Uma biblioteca simples para interagir com a IA da Pollinations.
|
|
5
|
+
Author: Angelo Guilherne
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: requests
|
|
11
|
+
Dynamic: author
|
|
12
|
+
Dynamic: classifier
|
|
13
|
+
Dynamic: description
|
|
14
|
+
Dynamic: description-content-type
|
|
15
|
+
Dynamic: requires-dist
|
|
16
|
+
Dynamic: summary
|
|
17
|
+
|
|
18
|
+
# pollinationsai
|
|
19
|
+
|
|
20
|
+
Uma biblioteca Python leve e sarcástica para interagir com a API da Pollinations AI.
|
|
21
|
+
Gerencie memória localmente, gere imagens e converse com a IA de forma simples.
|
|
22
|
+
|
|
23
|
+
## Instalação
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install pollinationsai
|
|
27
|
+
|
|
28
|
+
Como Usar
|
|
29
|
+
Aqui está um resumo de como utilizar as principais funcionalidades:
|
|
30
|
+
|
|
31
|
+
import pollinationsai as ai
|
|
32
|
+
|
|
33
|
+
# 1. Obter resposta da IA
|
|
34
|
+
resposta = ai.getaianswer("Qual a capital da França?")
|
|
35
|
+
print(resposta)
|
|
36
|
+
|
|
37
|
+
# 2. Definir persona (Ex: 'sarcástico')
|
|
38
|
+
print(ai.aipersona('sarcástico'))
|
|
39
|
+
|
|
40
|
+
# 3. Memorizar informações localmente (memory.json)
|
|
41
|
+
ai.aimemorize("Bugs são apenas funcionalidades não documentadas.")
|
|
42
|
+
print(ai.aihistory())
|
|
43
|
+
|
|
44
|
+
# 4. Gerar links de imagens via IA
|
|
45
|
+
link = ai.aiimagine("Um robô programando em Python")
|
|
46
|
+
print(f"Sua imagem: {link}")
|
|
47
|
+
|
|
48
|
+
# 5. Esquecer algo da memória
|
|
49
|
+
ai.aiforget("1")
|
|
50
|
+
|
|
51
|
+
Funcionalidades
|
|
52
|
+
getaianswer(prompt): Conecta com a IA e retorna texto puro.
|
|
53
|
+
aimemorize(data): Salva dados em um memory.json.
|
|
54
|
+
aiimagine(prompt): Retorna o link da imagem gerada pela Pollinations.
|
|
55
|
+
aistatus(): Verifica se o serviço está Online.
|
|
56
|
+
aipersona(estilo): Define o tom da conversa.
|
|
57
|
+
Licença
|
|
58
|
+
MIT
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from .core import (
|
|
2
|
+
getaianswer,
|
|
3
|
+
aimemorize,
|
|
4
|
+
aiimagine,
|
|
5
|
+
aiforget,
|
|
6
|
+
aihistory,
|
|
7
|
+
aistatus,
|
|
8
|
+
aipersona
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"getaianswer",
|
|
13
|
+
"aimemorize",
|
|
14
|
+
"aiimagine",
|
|
15
|
+
"aiforget",
|
|
16
|
+
"aihistory",
|
|
17
|
+
"aistatus",
|
|
18
|
+
"aipersona"
|
|
19
|
+
]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
import json
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
# Configurações globais
|
|
6
|
+
MEMORY_FILE = "memory.json"
|
|
7
|
+
_current_persona = "helpful assistant"
|
|
8
|
+
|
|
9
|
+
def _load_memory():
|
|
10
|
+
if not os.path.exists(MEMORY_FILE):
|
|
11
|
+
return {}
|
|
12
|
+
with open(MEMORY_FILE, "r", encoding="utf-8") as f:
|
|
13
|
+
try:
|
|
14
|
+
return json.load(f)
|
|
15
|
+
except json.JSONDecodeError:
|
|
16
|
+
return {}
|
|
17
|
+
|
|
18
|
+
def _save_memory(data):
|
|
19
|
+
with open(MEMORY_FILE, "w", encoding="utf-8") as f:
|
|
20
|
+
json.dump(data, f, indent=4)
|
|
21
|
+
|
|
22
|
+
def getaianswer(prompt):
|
|
23
|
+
# Endpoint corrigido para retornar apenas texto
|
|
24
|
+
url = f"https://text.pollinations.ai/{prompt}"
|
|
25
|
+
try:
|
|
26
|
+
response = requests.get(url)
|
|
27
|
+
return response.text
|
|
28
|
+
except Exception as e:
|
|
29
|
+
return f"Error: {e}"
|
|
30
|
+
|
|
31
|
+
def aimemorize(data):
|
|
32
|
+
memory = _load_memory()
|
|
33
|
+
key = str(len(memory) + 1)
|
|
34
|
+
memory[key] = data
|
|
35
|
+
_save_memory(memory)
|
|
36
|
+
return f"Stored: {data}"
|
|
37
|
+
|
|
38
|
+
def aiimagine(prompt):
|
|
39
|
+
return f"https://pollinations.ai/p/{prompt}"
|
|
40
|
+
|
|
41
|
+
def aiforget(key):
|
|
42
|
+
memory = _load_memory()
|
|
43
|
+
if key in memory:
|
|
44
|
+
del memory[key]
|
|
45
|
+
_save_memory(memory)
|
|
46
|
+
return True
|
|
47
|
+
return False
|
|
48
|
+
|
|
49
|
+
def aihistory():
|
|
50
|
+
return _load_memory()
|
|
51
|
+
|
|
52
|
+
def aistatus():
|
|
53
|
+
try:
|
|
54
|
+
response = requests.get("https://pollinations.ai/")
|
|
55
|
+
return "Online" if response.status_code == 200 else "Offline"
|
|
56
|
+
except:
|
|
57
|
+
return "Offline"
|
|
58
|
+
|
|
59
|
+
def aipersona(style):
|
|
60
|
+
global _current_persona
|
|
61
|
+
_current_persona = style
|
|
62
|
+
return f"Persona set to: {_current_persona}"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Python-Pollinations-AI
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Uma biblioteca simples para interagir com a IA da Pollinations.
|
|
5
|
+
Author: Angelo Guilherne
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: requests
|
|
11
|
+
Dynamic: author
|
|
12
|
+
Dynamic: classifier
|
|
13
|
+
Dynamic: description
|
|
14
|
+
Dynamic: description-content-type
|
|
15
|
+
Dynamic: requires-dist
|
|
16
|
+
Dynamic: summary
|
|
17
|
+
|
|
18
|
+
# pollinationsai
|
|
19
|
+
|
|
20
|
+
Uma biblioteca Python leve e sarcástica para interagir com a API da Pollinations AI.
|
|
21
|
+
Gerencie memória localmente, gere imagens e converse com a IA de forma simples.
|
|
22
|
+
|
|
23
|
+
## Instalação
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install pollinationsai
|
|
27
|
+
|
|
28
|
+
Como Usar
|
|
29
|
+
Aqui está um resumo de como utilizar as principais funcionalidades:
|
|
30
|
+
|
|
31
|
+
import pollinationsai as ai
|
|
32
|
+
|
|
33
|
+
# 1. Obter resposta da IA
|
|
34
|
+
resposta = ai.getaianswer("Qual a capital da França?")
|
|
35
|
+
print(resposta)
|
|
36
|
+
|
|
37
|
+
# 2. Definir persona (Ex: 'sarcástico')
|
|
38
|
+
print(ai.aipersona('sarcástico'))
|
|
39
|
+
|
|
40
|
+
# 3. Memorizar informações localmente (memory.json)
|
|
41
|
+
ai.aimemorize("Bugs são apenas funcionalidades não documentadas.")
|
|
42
|
+
print(ai.aihistory())
|
|
43
|
+
|
|
44
|
+
# 4. Gerar links de imagens via IA
|
|
45
|
+
link = ai.aiimagine("Um robô programando em Python")
|
|
46
|
+
print(f"Sua imagem: {link}")
|
|
47
|
+
|
|
48
|
+
# 5. Esquecer algo da memória
|
|
49
|
+
ai.aiforget("1")
|
|
50
|
+
|
|
51
|
+
Funcionalidades
|
|
52
|
+
getaianswer(prompt): Conecta com a IA e retorna texto puro.
|
|
53
|
+
aimemorize(data): Salva dados em um memory.json.
|
|
54
|
+
aiimagine(prompt): Retorna o link da imagem gerada pela Pollinations.
|
|
55
|
+
aistatus(): Verifica se o serviço está Online.
|
|
56
|
+
aipersona(estilo): Define o tom da conversa.
|
|
57
|
+
Licença
|
|
58
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
setup.py
|
|
3
|
+
Python-Pollinations-AI/__init__.py
|
|
4
|
+
Python-Pollinations-AI/core.py
|
|
5
|
+
Python_Pollinations_AI.egg-info/PKG-INFO
|
|
6
|
+
Python_Pollinations_AI.egg-info/SOURCES.txt
|
|
7
|
+
Python_Pollinations_AI.egg-info/dependency_links.txt
|
|
8
|
+
Python_Pollinations_AI.egg-info/requires.txt
|
|
9
|
+
Python_Pollinations_AI.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Python-Pollinations-AI
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# pollinationsai
|
|
2
|
+
|
|
3
|
+
Uma biblioteca Python leve e sarcástica para interagir com a API da Pollinations AI.
|
|
4
|
+
Gerencie memória localmente, gere imagens e converse com a IA de forma simples.
|
|
5
|
+
|
|
6
|
+
## Instalação
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install pollinationsai
|
|
10
|
+
|
|
11
|
+
Como Usar
|
|
12
|
+
Aqui está um resumo de como utilizar as principais funcionalidades:
|
|
13
|
+
|
|
14
|
+
import pollinationsai as ai
|
|
15
|
+
|
|
16
|
+
# 1. Obter resposta da IA
|
|
17
|
+
resposta = ai.getaianswer("Qual a capital da França?")
|
|
18
|
+
print(resposta)
|
|
19
|
+
|
|
20
|
+
# 2. Definir persona (Ex: 'sarcástico')
|
|
21
|
+
print(ai.aipersona('sarcástico'))
|
|
22
|
+
|
|
23
|
+
# 3. Memorizar informações localmente (memory.json)
|
|
24
|
+
ai.aimemorize("Bugs são apenas funcionalidades não documentadas.")
|
|
25
|
+
print(ai.aihistory())
|
|
26
|
+
|
|
27
|
+
# 4. Gerar links de imagens via IA
|
|
28
|
+
link = ai.aiimagine("Um robô programando em Python")
|
|
29
|
+
print(f"Sua imagem: {link}")
|
|
30
|
+
|
|
31
|
+
# 5. Esquecer algo da memória
|
|
32
|
+
ai.aiforget("1")
|
|
33
|
+
|
|
34
|
+
Funcionalidades
|
|
35
|
+
getaianswer(prompt): Conecta com a IA e retorna texto puro.
|
|
36
|
+
aimemorize(data): Salva dados em um memory.json.
|
|
37
|
+
aiimagine(prompt): Retorna o link da imagem gerada pela Pollinations.
|
|
38
|
+
aistatus(): Verifica se o serviço está Online.
|
|
39
|
+
aipersona(estilo): Define o tom da conversa.
|
|
40
|
+
Licença
|
|
41
|
+
MIT
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="Python-Pollinations-AI",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
install_requires=[
|
|
8
|
+
"requests",
|
|
9
|
+
],
|
|
10
|
+
author="Angelo Guilherne",
|
|
11
|
+
description="Uma biblioteca simples para interagir com a IA da Pollinations.",
|
|
12
|
+
long_description=open("README.md").read(),
|
|
13
|
+
long_description_content_type="text/markdown",
|
|
14
|
+
classifiers=[
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
],
|
|
19
|
+
)
|