Skip to content

Commit

Permalink
Improve readability in oai_completion.ipynb (microsoft#364)
Browse files Browse the repository at this point in the history
Co-authored-by: Chi Wang <wang.chi@microsoft.com>
  • Loading branch information
shruti222patel and sonichi committed Oct 22, 2023
1 parent 9278a54 commit c878fbc
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions notebook/oai_completion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
" - OpenAI API key: os.environ[\"OPENAI_API_KEY\"] or `openai_api_key_file=\"key_openai.txt\"`.\n",
" - Azure OpenAI API key: os.environ[\"AZURE_OPENAI_API_KEY\"] or `aoai_api_key_file=\"key_aoai.txt\"`. Multiple keys can be stored, one per line.\n",
" - Azure OpenAI API base: os.environ[\"AZURE_OPENAI_API_BASE\"] or `aoai_api_base_file=\"base_aoai.txt\"`. Multiple bases can be stored, one per line.\n",
"* The [`config_list_from_json`](https://microsoft.github.io/autogen/docs/reference/oai/openai_utils#config_list_from_json) function loads a list of configurations from an environment variable or a json file. It first looks for environment variable `env_or_file` which needs to be a valid json string. If that variable is not found, it then looks for a json file with the same name. It filters the configs by filter_dict.\n",
"* The [`config_list_from_json`](https://microsoft.github.io/autogen/docs/reference/oai/openai_utils#config_list_from_json) function loads a list of configurations from an environment variable or a json file. It first looks for the environment variable `env_or_file`, which must be a valid json string. If that variable is not found, it looks for a json file with the same name. It filters the configs by filter_dict.\n",
"\n",
"It's OK to have only the OpenAI API key, or only the Azure OpenAI API key + base. If you open this notebook in colab, you can upload your files by clicking the file icon on the left panel and then choose \"upload file\" icon.\n"
"It's OK to have only the OpenAI API key, or only the Azure OpenAI API key + base. If you open this notebook in colab, you can upload your files by clicking the file icon on the left panel and then choosing \"upload file\" icon.\n"
]
},
{
Expand Down Expand Up @@ -253,10 +253,10 @@
" \"\"\"I think we all remember that feeling when the result of some long-awaited\n",
" event is finally known. The feelings and thoughts you have at that moment are\n",
" definitely worth noting down and comparing.\n",
" Your task is to determine if a person correctly guessed the results of a number of matches.\n",
" Your task is to determine if a person correctly guessed the results of several matches.\n",
" You are given two arrays of scores and guesses of equal length, where each index shows a match. \n",
" Return an array of the same length denoting how far off each guess was. If they have guessed correctly,\n",
" the value is 0, and if not, the value is the absolute difference between the guess and the score.\n",
" the value is 0; if not, the value is the absolute difference between the guess and the score.\n",
" \n",
" \n",
" example:\n",
Expand Down Expand Up @@ -344,7 +344,7 @@
" autogen.code_utils.eval_function_completions,\n",
" assertions=partial(autogen.code_utils.generate_assertions, config_list=config_list),\n",
" use_docker=False,\n",
" # Please set use_docker=True if you have docker available to run the generated code.\n",
" # Please set use_docker=True if docker is available to run the generated code.\n",
" # Using docker is safer than running the generated code directly.\n",
")\n"
]
Expand Down Expand Up @@ -399,9 +399,9 @@
"\n",
"* `inference_budget` is the target average inference budget per instance in the benchmark. For example, 0.02 means the target inference budget is 0.02 dollars, which translates to 1000 tokens (input + output combined) if the text Davinci model is used.\n",
"* `optimization_budget` is the total budget allowed to perform the tuning. For example, 5 means 5 dollars are allowed in total, which translates to 250K tokens for the text Davinci model.\n",
"* `num_sumples` is the number of different hyperparameter configurations which is allowed to try. The tuning will stop after either num_samples trials or after optimization_budget dollars spent, whichever happens first. -1 means no hard restriction in the number of trials and the actual number is decided by `optimization_budget`.\n",
"* `num_sumples` is the number of different hyperparameter configurations allowed to be tried. The tuning will stop after either num_samples trials or after optimization_budget dollars spent, whichever happens first. -1 means no hard restriction in the number of trials and the actual number is decided by `optimization_budget`.\n",
"\n",
"Users can specify tuning data, optimization metric, optimization mode, evaluation function, search spaces etc.. The default search space is:\n",
"Users can specify tuning data, optimization metric, optimization mode, evaluation function, search spaces, etc. The default search space is:\n",
"\n",
"```python\n",
"default_search_space = {\n",
Expand All @@ -424,8 +424,8 @@
"}\n",
"```\n",
"\n",
"The default search space can be overridden by users' input.\n",
"For example, the following code specifies three choices for the prompt and two choices of stop sequences. For hyperparameters which don't appear in users' input, the default search space will be used. If you don't have access to gpt-4 or would like to modify the choice of models, you can provide a different search space for model."
"Users' input can override the default search space.\n",
"For example, the following code specifies three choices for the prompt and two choices of stop sequences. The default search space will be used for hyperparameters that don't appear in users' input. If you don't have access to gpt-4 or would like to modify the choice of models, you can provide a different search space for the model."
]
},
{
Expand Down Expand Up @@ -534,7 +534,7 @@
}
},
"source": [
"### Make a request with the tuned config\n",
"### Request with the tuned config\n",
"\n",
"We can apply the tuned config on the request for an example task:"
]
Expand Down

0 comments on commit c878fbc

Please sign in to comment.