You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-21Lines changed: 28 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -628,44 +628,51 @@ In addition to the options provided in the base `OpenAI` client, the following o
628
628
An example of using the client with Microsoft Entra ID (formerly known as Azure Active Directory) can be found [here](https://github.com/openai/openai-python/blob/main/examples/azure_ad.py).
629
629
630
630
## Activating CLI Autocomplete
631
+
Use the following commands to activate CLI autocompletion for each shell.
631
632
632
-
### Using CLI Autocomplete
633
-
Using the following sequence of commands for each shell will activate the autocompletion feature for the CLI.
634
-
#### Bash
635
-
1. Register ‘openai’ command for argument completion by running:
633
+
### Bash & Zsh
634
+
Configure your shell to support global auto completion for python scripts by running:
636
635
```shell
637
-
register-python-argcomplete openai >>~/.bashrc
636
+
activate-global-python-argcomplete
638
637
```
639
-
640
-
#### Zsh
641
-
1. Register ‘openai’ command for argument completion by running:
638
+
Use this command to register `openai` for argument completion using argcomplete for the current terminal session:
642
639
```shell
640
+
eval"$(register-python-argcomplete openai)"
641
+
```
642
+
Alternatively, run this command to register `openai` for argument completion permanently, eliminating the need to run the `eval` command each time the terminal is restarted or killed.
643
+
For Bash:
644
+
```shell
645
+
register-python-argcomplete openai >>~/.bashrc
646
+
```
647
+
For Zsh:
648
+
```shell
643
649
register-python-argcomplete openai >>~/.zshrc
644
650
```
645
651
646
-
#### Fish
647
-
1. Register ‘openai’ command for argument completion by running:
652
+
###Powershell
653
+
To activate completions for Powershell use:
648
654
```shell
649
-
register-python-argcomplete --shell fish openai >~/.config/fish/config.fish
2. If you don't already have a ``$PROFILE`` you can add this by running:
661
+
To activate the completions file, open the [``$PROFILE``](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.4&viewFallbackFrom=powershell-7.3#how-to-create-a-profile) by running ``notepad $PROFILE`` and add this following line:
659
662
```shell
660
-
New-Item -ItemType File -Path $PROFILE -Force
663
+
Import-Module "~/openai.psm1"
661
664
```
662
-
663
-
3. Open the [``$PROFILE``](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.4&viewFallbackFrom=powershell-7.3#how-to-create-a-profile) by running ``notepad $PROFILE`` and add this following line:
665
+
### Fish
666
+
To activate completions for fish use:
664
667
```shell
665
-
Import-Module "~/openai.psm1"
668
+
register-python-argcomplete --shell fish openai |source
669
+
```
670
+
Alternatively, create a new completion file. This command will persist even if the terminal is killed or restarted.
671
+
```shell
672
+
register-python-argcomplete --shell fish openai >~/.config/fish/config.fish
666
673
```
667
674
668
-
####Usage
675
+
### Usage
669
676
After completing the appropriate steps for your shell, restart the terminal and try:
0 commit comments