- Notifications
You must be signed in to change notification settings - Fork2
Use Open AI models in xonsh shell.
License
NotificationsYou must be signed in to change notification settings
anki-code/xontrib-openai
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Use Open AI models in xonsh shell.
If you like the idea click ⭐ on the repo andtweet.
To install use pip:
xpipinstall-Uxontrib-openai# or: xpip install -U git+https://github.com/anki-code/xontrib-openai
$OPENAI_API_KEY='abcd1234'# https://platform.openai.com/account/api-keys# Defaults:# $OPENAI_MODEL = 'text-davinci-003' # https://platform.openai.com/docs/models/overview# $OPENAI_MAX_TOKENS = 500xontribloadopenaiai!hello# Hello! How are you?
In case you need addon with new model:
aliases['ai4']="$OPENAI_MODEL='gpt-4' $OPENAI_MAX_TOKENS=1000 @('ai')"ai4!hellogpt-4# Hello human
ai!howtogitcommit.Givemeonlycommand# git commit -m "Commit message"
ai!howtoremoveallcontainersandimagesindocker.Onlycommandsplease# docker stop $(docker ps -a -q)# docker rm $(docker ps -a -q)# docker rmi $(docker images -a -q)
ai!sendpostrequestwithjsondataonpython# import requests# import json## url = 'http://example.com/api/1/users'# data = {# "first_name": "John",# "last_name": "Smith"# }## headers = {'Content-type': 'application/json'}# response = requests.post(url, data=json.dumps(data), headers=headers)
ai!givemejsonwherekeysarefruitsandvaluesaremostcommonfruitcolor# {# "Apple": "Red",# "Banana": "Yellow",# "Orange": "Orange",# "Grape": "Purple",# "Strawberry": "Red",# "Lemon": "Yellow",# "Kiwi": "Green",# "Cherry": "Red",# "Watermelon": "Green"# }
Using the data:
importjsonj=json.loads($(aigivemesmalljson))j# {'name': 'John', 'age': 25}
To usegpt-4
model joinwait list.
This package was created withxontrib template.
About
Use Open AI models in xonsh shell.