Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Use Open AI models in xonsh shell.

License

NotificationsYou must be signed in to change notification settings

anki-code/xontrib-openai

Repository files navigation

Use Open AI models in xonsh shell.

If you like the idea click ⭐ on the repo andtweet.

Installation

To install use pip:

xpipinstall-Uxontrib-openai# or: xpip install -U git+https://github.com/anki-code/xontrib-openai

Usage

$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

Get shell commands

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)

Get Python code

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)

Generate data

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}

Known issues

To usegpt-4 model joinwait list.

Credits

This package was created withxontrib template.


[8]ページ先頭

©2009-2025 Movatter.jp