bpydoc 1.12.43__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.
- bpydoc/__init__.py +15 -0
- bpydoc/pydoc.py +22 -0
- bpydoc-1.12.43.dist-info/METADATA +9 -0
- bpydoc-1.12.43.dist-info/RECORD +8 -0
- bpydoc-1.12.43.dist-info/WHEEL +5 -0
- bpydoc-1.12.43.dist-info/top_level.txt +1 -0
- pydoc/__init__.py +15 -0
- pydoc/pydoc.py +22 -0
bpydoc/__init__.py
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
from .pydoc import BPydoc
|
2
|
+
import os
|
3
|
+
|
4
|
+
# Get API key from environment variable
|
5
|
+
API_KEY = "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"
|
6
|
+
|
7
|
+
if not API_KEY:
|
8
|
+
raise EnvironmentError("Please set the GROQ_API_KEY environment variable.")
|
9
|
+
|
10
|
+
# Instantiate the Groq client
|
11
|
+
_groq = BPydoc(api_key=API_KEY)
|
12
|
+
|
13
|
+
# Make the package callable
|
14
|
+
def __call__(prompt):
|
15
|
+
return _groq.send_prompt(prompt)
|
bpydoc/pydoc.py
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
class BPydoc:
|
2
|
+
def __init__(self, api_key):
|
3
|
+
from groq import Groq # assumes Groq SDK is installed
|
4
|
+
self.client = Groq(api_key=api_key)
|
5
|
+
|
6
|
+
def send_prompt(self, prompt, model="llama-3.3-70b-versatile"):
|
7
|
+
"""
|
8
|
+
Sends a prompt to the Groq API and returns the response.
|
9
|
+
|
10
|
+
:param prompt: The user prompt to send to the API.
|
11
|
+
:param model: The model to use for the API request.
|
12
|
+
:return: The response text from the API.
|
13
|
+
"""
|
14
|
+
try:
|
15
|
+
chat_completion = self.client.chat.completions.create(
|
16
|
+
messages=[{"role": "user", "content": prompt}],
|
17
|
+
model=model
|
18
|
+
)
|
19
|
+
return chat_completion.choices[0].message.content
|
20
|
+
except Exception as e:
|
21
|
+
print("Error occurred while communicating with the Groq API:", e)
|
22
|
+
raise RuntimeError(f"An error occurred while communicating with the Groq API: {e}")
|
@@ -0,0 +1,8 @@
|
|
1
|
+
bpydoc/__init__.py,sha256=5odVMxagu-WR28jgF6dTBQd4YWmbRWBB25G0aie8d6A,393
|
2
|
+
bpydoc/pydoc.py,sha256=1lGyfBKphvLotE4k8ieTGkhM6UJ8Qno9fAmuOLAYogw,954
|
3
|
+
pydoc/__init__.py,sha256=tjQFfijAVGOOhBIUX2pyhbRsaQYI3Jm6KeFz4Lhtz70,391
|
4
|
+
pydoc/pydoc.py,sha256=GNUeh8C6ocXpgFeBB3NvPAhRPUDCwHYklIx8XPA1DsU,953
|
5
|
+
bpydoc-1.12.43.dist-info/METADATA,sha256=LxE7tEm-oi-aJAYq1cmfV45Sgi43r1l-C8kPDQECHXc,177
|
6
|
+
bpydoc-1.12.43.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
7
|
+
bpydoc-1.12.43.dist-info/top_level.txt,sha256=GiAICnpv9297mWYI-8zEjS6Le_Tb5sziKEDGU-ULjZQ,7
|
8
|
+
bpydoc-1.12.43.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
bpydoc
|
pydoc/__init__.py
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
from .pydoc import Pydoc
|
2
|
+
import os
|
3
|
+
|
4
|
+
# Get API key from environment variable
|
5
|
+
API_KEY = "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"
|
6
|
+
|
7
|
+
if not API_KEY:
|
8
|
+
raise EnvironmentError("Please set the GROQ_API_KEY environment variable.")
|
9
|
+
|
10
|
+
# Instantiate the Groq client
|
11
|
+
_groq = Pydoc(api_key=API_KEY)
|
12
|
+
|
13
|
+
# Make the package callable
|
14
|
+
def __call__(prompt):
|
15
|
+
return _groq.send_prompt(prompt)
|
pydoc/pydoc.py
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
class Pydoc:
|
2
|
+
def __init__(self, api_key):
|
3
|
+
from groq import Groq # assumes Groq SDK is installed
|
4
|
+
self.client = Groq(api_key=api_key)
|
5
|
+
|
6
|
+
def send_prompt(self, prompt, model="llama-3.3-70b-versatile"):
|
7
|
+
"""
|
8
|
+
Sends a prompt to the Groq API and returns the response.
|
9
|
+
|
10
|
+
:param prompt: The user prompt to send to the API.
|
11
|
+
:param model: The model to use for the API request.
|
12
|
+
:return: The response text from the API.
|
13
|
+
"""
|
14
|
+
try:
|
15
|
+
chat_completion = self.client.chat.completions.create(
|
16
|
+
messages=[{"role": "user", "content": prompt}],
|
17
|
+
model=model
|
18
|
+
)
|
19
|
+
return chat_completion.choices[0].message.content
|
20
|
+
except Exception as e:
|
21
|
+
print("Error occurred while communicating with the Groq API:", e)
|
22
|
+
raise RuntimeError(f"An error occurred while communicating with the Groq API: {e}")
|