Spaces:
Running
Running
Added OPENAI_API_BASE.
Browse files- Dockerfile +2 -1
- README.md +24 -0
- meta_prompt.py +8 -2
Dockerfile
CHANGED
@@ -13,6 +13,7 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
13 |
# Set the environment variables
|
14 |
ENV API_KEY=""
|
15 |
ENV PROXY=""
|
|
|
16 |
ENV OTHER_ARGS="--advanced_mode"
|
17 |
ENV ADVANCED_MODE="true"
|
18 |
ENV SERVER_NAME="0.0.0.0"
|
@@ -21,4 +22,4 @@ ENV SERVER_NAME="0.0.0.0"
|
|
21 |
EXPOSE 7860
|
22 |
|
23 |
# Run the script when the container launches
|
24 |
-
CMD /usr/local/bin/python3 meta_prompt.py --api_key=${API_KEY} --proxy=${PROXY} --server_name=${SERVER_NAME} ${OTHER_ARGS}
|
|
|
13 |
# Set the environment variables
|
14 |
ENV API_KEY=""
|
15 |
ENV PROXY=""
|
16 |
+
ENV OPENAI_API_BASE=""
|
17 |
ENV OTHER_ARGS="--advanced_mode"
|
18 |
ENV ADVANCED_MODE="true"
|
19 |
ENV SERVER_NAME="0.0.0.0"
|
|
|
22 |
EXPOSE 7860
|
23 |
|
24 |
# Run the script when the container launches
|
25 |
+
CMD /usr/local/bin/python3 meta_prompt.py --api_key=${API_KEY} --proxy=${PROXY} --openai_api_base=${OPENAI_API_BASE} --server_name=${SERVER_NAME} ${OTHER_ARGS}
|
README.md
CHANGED
@@ -72,6 +72,30 @@ If you have access to ChatGPT and want to save costs on GPT-4 API usage, you can
|
|
72 |
= 30
|
73 |
```
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
### GDP
|
76 |
|
77 |
#### Testing User Prompt
|
|
|
72 |
= 30
|
73 |
```
|
74 |
|
75 |
+
#### Prompt After 4 Interations
|
76 |
+
|
77 |
+
```
|
78 |
+
ROLE
|
79 |
+
|
80 |
+
You are a math tutor.
|
81 |
+
|
82 |
+
TASK
|
83 |
+
|
84 |
+
Your task is to solve the mathematical expression provided by the user and provide a concise, step-by-step solution. Each step should only include the calculation and the result, without any additional explanations or step labels.
|
85 |
+
|
86 |
+
REQUIREMENTS AND RESTRICTIONS
|
87 |
+
|
88 |
+
* The solution should be provided in standard mathematical notation.
|
89 |
+
* The format of the mathematical expressions should be consistent with the user's input.
|
90 |
+
* The symbols used in the mathematical expressions should be consistent with the user's input.
|
91 |
+
* No spaces should be included around the mathematical operators.
|
92 |
+
* Avoid unnecessary explanations or verbosity.
|
93 |
+
* Do not include any additional information or explanations beyond the direct calculation steps.
|
94 |
+
* Do not include a final solution statement.
|
95 |
+
|
96 |
+
{user_message}
|
97 |
+
```
|
98 |
+
|
99 |
### GDP
|
100 |
|
101 |
#### Testing User Prompt
|
meta_prompt.py
CHANGED
@@ -24,9 +24,14 @@ from prompt_ui import PromptUI
|
|
24 |
|
25 |
class ChatbotApp:
|
26 |
def __init__(self, args):
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
28 |
if args.proxy:
|
29 |
-
|
30 |
|
31 |
self.prompt_ui = PromptUI(advanced_mode=args.advanced_mode)
|
32 |
|
@@ -46,6 +51,7 @@ def parse_args():
|
|
46 |
parser.add_argument("--advanced_mode", action='store_true', default=False,
|
47 |
help="Enable advanced mode")
|
48 |
parser.add_argument("--server_name", type=str, default="127.0.0.1", help="Server name or IP address")
|
|
|
49 |
|
50 |
return parser.parse_args()
|
51 |
|
|
|
24 |
|
25 |
class ChatbotApp:
|
26 |
def __init__(self, args):
|
27 |
+
if args.api_key:
|
28 |
+
os.environ["OPENAI_API_KEY"] = args.api_key
|
29 |
+
|
30 |
+
if args.openai_api_base:
|
31 |
+
os.environ["OPENAI_API_BASE"] = args.openai_api_base
|
32 |
+
|
33 |
if args.proxy:
|
34 |
+
os.environ["OPENAI_PROXY"] = args.proxy
|
35 |
|
36 |
self.prompt_ui = PromptUI(advanced_mode=args.advanced_mode)
|
37 |
|
|
|
51 |
parser.add_argument("--advanced_mode", action='store_true', default=False,
|
52 |
help="Enable advanced mode")
|
53 |
parser.add_argument("--server_name", type=str, default="127.0.0.1", help="Server name or IP address")
|
54 |
+
parser.add_argument("--openai_api_base", type=str, default=None, help="OpenAI API base URL")
|
55 |
|
56 |
return parser.parse_args()
|
57 |
|