Skip to content

Commit fa4813c

Browse files
committed
wip - kamangir/bolt#746 - no-workflow 🪄
1 parent 797e8ad commit fa4813c

File tree

6 files changed

+117
-93
lines changed

6 files changed

+117
-93
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ graph LR
3131

3232
[![pylint](https://github.com/kamangir/openai-commands/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/openai-commands/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/openai-commands/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/openai-commands/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/openai-commands/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/openai-commands/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/openai-commands.svg)](https://pypi.org/project/openai-commands/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/openai-commands)](https://pypistats.org/packages/openai-commands)
3333

34-
built by 🌀 [`blue_options-4.200.1`](https://github.com/kamangir/awesome-bash-cli), based on [`openai_commands-3.209.1`](https://github.com/kamangir/openai-commands).
34+
built by 🌀 [`blue_options-4.200.1`](https://github.com/kamangir/awesome-bash-cli), based on [`openai_commands-3.210.1`](https://github.com/kamangir/openai-commands).

notebooks/images_generate.ipynb

+81-31
Large diffs are not rendered by default.

notebooks/sandbox.ipynb

+30-37
Original file line numberDiff line numberDiff line change
@@ -14,57 +14,48 @@
1414
"cell_type": "code",
1515
"execution_count": 1,
1616
"metadata": {},
17-
"outputs": [],
18-
"source": [
19-
"import sys\n",
20-
"sys.path.append(\"../\")\n",
21-
"\n",
22-
"from blueflow import notebooks\n",
23-
"\n",
24-
"from blue_options import string\n",
25-
"from blue_objects import objects\n",
26-
"\n",
27-
"from openai_commands.host import signature\n",
28-
"from openai_commands.logger import logger\n",
29-
"\n",
30-
"logger.info(f\"{'.'.join(signature())},\\nbuilt on {string.pretty_date()}\")"
31-
]
32-
},
33-
{
34-
"cell_type": "code",
35-
"execution_count": 2,
36-
"metadata": {},
3717
"outputs": [
3818
{
3919
"name": "stderr",
4020
"output_type": "stream",
4121
"text": [
42-
" 🛠️ :: abcli-7.2928.1-current, built on 22 March 2024, 19:14:19\n"
22+
"🛠️ openai_commands-3.209.1.blueflow-4.849.1.abcli-9.486.1.blue_objects-5.281.1.blue_options-4.200.1.torch-2.5.1.Python 3.9.6.Darwin 23.6.0..Jupyter-Notebook,\n",
23+
"built on 01 February 2025, 11:11:16\n"
4324
]
4425
}
4526
],
4627
"source": [
28+
"import sys\n",
29+
"sys.path.append(\"../\")\n",
30+
"\n",
31+
"from blueflow import notebooks\n",
32+
"\n",
4733
"import json\n",
48-
"from abcli import fullname, string\n",
4934
"from openai import OpenAI\n",
35+
"\n",
36+
"from blue_options import string\n",
37+
"from blue_objects import objects\n",
38+
"\n",
39+
"from openai_commands.host import signature\n",
5040
"from openai_commands import env\n",
5141
"from openai_commands.logger import logger\n",
5242
"\n",
53-
"logger.info(f\"{fullname()}, built on {string.pretty_date()}\")"
43+
"logger.info(f\"{'.'.join(signature())},\\nbuilt on {string.pretty_date()}\")"
5444
]
5545
},
5646
{
5747
"cell_type": "code",
58-
"execution_count": 3,
48+
"execution_count": 2,
5949
"metadata": {},
6050
"outputs": [],
6151
"source": [
52+
"assert env.OPENAI_API_KEY\n",
6253
"client = OpenAI(api_key=env.OPENAI_API_KEY)"
6354
]
6455
},
6556
{
6657
"cell_type": "code",
67-
"execution_count": 4,
58+
"execution_count": 3,
6859
"metadata": {},
6960
"outputs": [],
7061
"source": [
@@ -73,14 +64,14 @@
7364
},
7465
{
7566
"cell_type": "code",
76-
"execution_count": 5,
67+
"execution_count": 4,
7768
"metadata": {},
7869
"outputs": [
7970
{
8071
"name": "stderr",
8172
"output_type": "stream",
8273
"text": [
83-
" httpx :: HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n"
74+
"httpx HTTP Request: POST https://api.openai.com/v1/chat/completions \"HTTP/1.1 200 OK\"\n"
8475
]
8576
}
8677
],
@@ -98,24 +89,26 @@
9889
},
9990
{
10091
"cell_type": "code",
101-
"execution_count": 6,
92+
"execution_count": 5,
10293
"metadata": {},
10394
"outputs": [
10495
{
10596
"name": "stderr",
10697
"output_type": "stream",
10798
"text": [
108-
" 🛠️ :: [\n",
99+
"🛠️ [\n",
109100
" {\n",
110101
" \"finish_reason\": \"stop\",\n",
111102
" \"index\": 0,\n",
103+
" \"logprobs\": null,\n",
112104
" \"message\": {\n",
113-
" \"content\": \"Mathematics is a field of study that deals with the properties and relationships of numbers, quantities, shapes, and patterns. It involves the use of logic and reasoning to solve problems and understand the fundamental concepts of the universe. Mathematics is a universal language that is used across various disciplines such as science, engineering, economics, and computer science. It is divided into various branches such as algebra, geometry, calculus, statistics, and number theory, each with its own set of rules and principles. Mathematics plays a crucial role in our everyday lives, from simple calculations to complex scientific theories. It allows us to make sense of the world around us and make informed decisions based on data and evidence.\",\n",
105+
" \"content\": \"Mathematics is the study of numbers, quantity, structure, space, and change. It involves abstract concepts such as algorithms, logic, and infinity, as well as practical applications in almost every aspect of our lives. Mathematics uses symbols, formulas, and equations to describe relationships and patterns, and it is used to model and analyze the world around us. It is considered the universal language of science and is used in a wide range of fields including physics, engineering, economics, and computer science. Mathematics is also used to solve problems, make predictions, and generate new knowledge.\",\n",
106+
" \"refusal\": null,\n",
114107
" \"role\": \"assistant\",\n",
108+
" \"audio\": null,\n",
115109
" \"function_call\": null,\n",
116110
" \"tool_calls\": null\n",
117-
" },\n",
118-
" \"logprobs\": null\n",
111+
" }\n",
119112
" }\n",
120113
"]\n"
121114
]
@@ -127,14 +120,14 @@
127120
},
128121
{
129122
"cell_type": "code",
130-
"execution_count": 7,
123+
"execution_count": 6,
131124
"metadata": {},
132125
"outputs": [
133126
{
134127
"name": "stderr",
135128
"output_type": "stream",
136129
"text": [
137-
" 🛠️ :: Mathematics is a field of study that deals with the properties and relationships of numbers, quantities, shapes, and patterns. It involves the use of logic and reasoning to solve problems and understand the fundamental concepts of the universe. Mathematics is a universal language that is used across various disciplines such as science, engineering, economics, and computer science. It is divided into various branches such as algebra, geometry, calculus, statistics, and number theory, each with its own set of rules and principles. Mathematics plays a crucial role in our everyday lives, from simple calculations to complex scientific theories. It allows us to make sense of the world around us and make informed decisions based on data and evidence.\n"
130+
"🛠️ Mathematics is the study of numbers, quantity, structure, space, and change. It involves abstract concepts such as algorithms, logic, and infinity, as well as practical applications in almost every aspect of our lives. Mathematics uses symbols, formulas, and equations to describe relationships and patterns, and it is used to model and analyze the world around us. It is considered the universal language of science and is used in a wide range of fields including physics, engineering, economics, and computer science. Mathematics is also used to solve problems, make predictions, and generate new knowledge.\n"
138131
]
139132
}
140133
],
@@ -145,7 +138,7 @@
145138
},
146139
{
147140
"cell_type": "code",
148-
"execution_count": 8,
141+
"execution_count": 7,
149142
"metadata": {},
150143
"outputs": [],
151144
"source": [
@@ -155,7 +148,7 @@
155148
],
156149
"metadata": {
157150
"kernelspec": {
158-
"display_name": "Python 3 (ipykernel)",
151+
"display_name": ".venv",
159152
"language": "python",
160153
"name": "python3"
161154
},
@@ -169,7 +162,7 @@
169162
"name": "python",
170163
"nbconvert_exporter": "python",
171164
"pygments_lexer": "ipython3",
172-
"version": "3.9.18"
165+
"version": "3.9.6"
173166
},
174167
"toc": {
175168
"base_numbering": 1,

openai_commands/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
DESCRIPTION = f"{ICON} a command interface to the OpenAI API."
66

7-
VERSION = "3.209.1"
7+
VERSION = "3.210.1"
88

99
REPO_NAME = "openai-commands"
1010

openai_commands/images/api.py

+3-22
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ def __init__(
2222
model="dall-e-3",
2323
verbose: bool = False,
2424
):
25+
assert env.OPENAI_API_KEY
26+
2527
self.client = OpenAI(api_key=env.OPENAI_API_KEY)
2628
self.verbose = verbose
2729
self.model = model
@@ -45,11 +47,9 @@ def generate(
4547
)
4648
)
4749

48-
augmented_prompt = self.augment_prompt(prompt)
49-
5050
response = self.client.images.generate(
5151
model=self.model,
52-
prompt=augmented_prompt,
52+
prompt=prompt,
5353
size="1024x1024",
5454
quality="standard",
5555
n=1,
@@ -90,22 +90,3 @@ def generate(
9090
success,
9191
response,
9292
)
93-
94-
def augment_prompt(self, prompt: str) -> str:
95-
# https://community.openai.com/t/api-image-generation-in-dall-e-3-changes-my-original-prompt-without-my-permission/476355
96-
prompt = " ".join(
97-
[
98-
"THIS IS A RAW EXECUTION. ABSOLUTELY DO NOT REVISE THIS PROMPT:",
99-
prompt,
100-
]
101-
)
102-
103-
if self.verbose:
104-
logger.info(
105-
"{}.augment_prompt: {}".format(
106-
self.__class__.__name__,
107-
prompt,
108-
)
109-
)
110-
111-
return prompt

openai_commands/literature_review/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ literature review at scale on [AWS Batch](https://aws.amazon.com/batch/) through
4949
| | |
5050
| --- | --- |
5151
| [aws_batch](https://github.com/kamangir/notebooks-and-scripts/tree/main/blueflow/workflow/runners/aws_batch.py) | [local](https://github.com/kamangir/notebooks-and-scripts/tree/main/blueflow/workflow/runners/local.py) |
52-
| [![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/AMR-v7-test-litrev-multiple-aws_batch-study-type-screening-result/workflow.gif?raw=true&random=9vn3l8l417ktrmm1)](https://kamangir-public.s3.ca-central-1.amazonaws.com/AMR-v7-test-litrev-multiple-aws_batch-study-type-screening-result/workflow.gif?raw=true&random=9vn3l8l417ktrmm1) | [![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/AMR-v7-test-litrev-multiple-local-study-type-screening-result/workflow.gif?raw=true&random=rl3f4lunt251h55v)](https://kamangir-public.s3.ca-central-1.amazonaws.com/AMR-v7-test-litrev-multiple-local-study-type-screening-result/workflow.gif?raw=true&random=rl3f4lunt251h55v) |
52+
| [![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/AMR-v7-test-litrev-multiple-aws_batch-study-type-screening-result/workflow.gif?raw=true&random=ldg5638tmhtmlsdm)](https://kamangir-public.s3.ca-central-1.amazonaws.com/AMR-v7-test-litrev-multiple-aws_batch-study-type-screening-result/workflow.gif?raw=true&random=ldg5638tmhtmlsdm) | [![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/AMR-v7-test-litrev-multiple-local-study-type-screening-result/workflow.gif?raw=true&random=14hrsv1ndukxyr8h)](https://kamangir-public.s3.ca-central-1.amazonaws.com/AMR-v7-test-litrev-multiple-local-study-type-screening-result/workflow.gif?raw=true&random=14hrsv1ndukxyr8h) |
5353

5454
---
5555

0 commit comments

Comments
 (0)