Giter Club home page Giter Club logo

gptutil's Introduction

GPT utility

English | 日本語

Command utility for creating your own AI assistant

Installation

pip install gptutil

Usage

  • Ask ChatGPT questions in a pipeline:
export OPENAI_API_KEY="OpenAI API Key"

git clone git clone https://github.com/openai/evals/
cp evals/evals/registry/data/test_fuzzy_match/samples.jsonl .
cat samples.jsonl | gpt-ask 'Translate this.'
cat samples.jsonl | gpt-ask 'Translate this.' |jq |less
cat samples.jsonl | gpt-ask 'Translate this.' | gpt-ask 'Use jq to extract all "content" values with "role" equal to "user".'
  • Debug commands interactively:
gpt-interact -n simple_chat

or

gpt-interact -n simple_chat -t gptutil/example/assistant.yaml

You can also customize your own assistant by modifying this file.

Command Description
@use AssistantName Switches to a different assistant.
@history Displays chat history.
@reset Clears the input and chat history for the assistant.
@params Show set assistant paramaters
! (e.g. !ls -l, !bash) Executes a command in the middle of a question and displays the result.
Assistant Description
simple_chat Normal chat.
command_debug Displays solutions by executing commands and displaying error messages.
pentest Explains penetration testing tools and procedures step by step.

Demo

Asking ChatGPT questions in a pipeline

Debugging commands interactively

gptutil's People

Contributors

tatsuiman avatar

Stargazers

Nakamura Kazutaka avatar

Watchers

 avatar Kostas Georgiou avatar  avatar

gptutil's Issues

Fix to be able to split and process huge files by token size limit even when huge files are input

Currently, standard input exceeding the token size cannot be processed.

Traceback (most recent call last):
  File "/home/tatsui/.virtualenvs/poc/bin/gpt-ask", line 33, in <module>
    sys.exit(load_entry_point('gptutil', 'console_scripts', 'gpt-ask')())
  File "/home/tatsui/.virtualenvs/poc/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/tatsui/.virtualenvs/poc/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/tatsui/.virtualenvs/poc/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/tatsui/.virtualenvs/poc/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/tatsui/gptutil/gptutil/ask.py", line 42, in main
    for resp in openai.ChatCompletion.create(
  File "/home/tatsui/.virtualenvs/poc/lib/python3.10/site-packages/openai/api_resources/chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
  File "/home/tatsui/.virtualenvs/poc/lib/python3.10/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
  File "/home/tatsui/.virtualenvs/poc/lib/python3.10/site-packages/openai/api_requestor.py", line 226, in request
    resp, got_stream = self._interpret_response(result, stream)
  File "/home/tatsui/.virtualenvs/poc/lib/python3.10/site-packages/openai/api_requestor.py", line 619, in _interpret_response
    self._interpret_response_line(
  File "/home/tatsui/.virtualenvs/poc/lib/python3.10/site-packages/openai/api_requestor.py", line 682, in _interpret_response_line
    raise self.handle_error_response(
openai.error.InvalidRequestError: This model's maximum context length is 4097 tokens. However, your messages resulted in 18450 tokens. Please reduce the length of the messages.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.