flashyapi 1.0.0__tar.gz → 1.0.2__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.
@@ -0,0 +1,3 @@
1
+ from .main import generate
2
+
3
+ __version__ = "1.0.2"
@@ -0,0 +1,31 @@
1
+ import requests
2
+ import json
3
+
4
+ API_URL = "https://flashapi.floxylabs.eu/v1/chat/completions"
5
+
6
+ def generate(apiKey: str, model: str, prompt: str, streaming: bool):
7
+ headers = {
8
+ "Authorization": f"Bearer {apiKey}",
9
+ "Content-Type": "application/json"
10
+ }
11
+
12
+ payload = {
13
+ "model": model,
14
+ "messages": [{"role": "user", "content": prompt}],
15
+ "stream": streaming
16
+ }
17
+
18
+ if streaming:
19
+ response = requests.post(API_URL, headers=headers, json=payload, stream=True)
20
+ if response.status_code == 200:
21
+ for line in response.iter_lines():
22
+ if line:
23
+ print(line.decode("utf-8"))
24
+ else:
25
+ print(f"Error: {response.status_code} - {response.text}")
26
+ else:
27
+ response = requests.post(API_URL, headers=headers, json=payload)
28
+ if response.status_code == 200:
29
+ print(json.dumps(response.json(), indent=2))
30
+ else:
31
+ print(f"Error: {response.status_code} - {response.text}")
@@ -1,6 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flashyapi
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: Fast and simple API utilities
5
5
  Author: floxxy0
6
6
  Requires-Python: >=3.10
7
+ Requires-Dist: requests
@@ -1,6 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flashyapi
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: Fast and simple API utilities
5
5
  Author: floxxy0
6
6
  Requires-Python: >=3.10
7
+ Requires-Dist: requests
@@ -1,7 +1,8 @@
1
1
  pyproject.toml
2
- flashapi/__init__.py
3
- flashapi/main.py
2
+ FlashyAPI/__init__.py
3
+ FlashyAPI/main.py
4
4
  flashyapi.egg-info/PKG-INFO
5
5
  flashyapi.egg-info/SOURCES.txt
6
6
  flashyapi.egg-info/dependency_links.txt
7
+ flashyapi.egg-info/requires.txt
7
8
  flashyapi.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requests
@@ -0,0 +1 @@
1
+ FlashyAPI
@@ -1,13 +1,13 @@
1
1
  [project]
2
2
  name = "flashyapi"
3
- version = "1.0.0"
3
+ version = "1.0.2"
4
4
  description = "Fast and simple API utilities"
5
5
  authors = [
6
6
  {name = "floxxy0"}
7
7
  ]
8
8
 
9
9
  requires-python = ">=3.10"
10
- dependencies = []
10
+ dependencies = ["requests"]
11
11
 
12
12
  [build-system]
13
13
  requires = ["setuptools", "wheel"]
@@ -1,3 +0,0 @@
1
- from .main import hello
2
-
3
- __version__ = "1.0.0"
@@ -1,2 +0,0 @@
1
- def hello():
2
- return "FlashAPI is ready!"
@@ -1 +0,0 @@
1
- flashapi
File without changes