ochat
Fork of sgpt to support Ollama.
A command-line productivity tool powered by AI large language models (LLM). This command-line tool offers streamlined generation of shell commands, code snippets, documentation, eliminating the need for external resources (like Google search).
[!TIP]
This project is still in development. The current version is a prototype.
Many features implemented in the original shell_gpt are not yet available in this project.
Usage (borrowed from shell_gpt )
This tool is designed to quickly analyse and retrieve information. It's useful for straightforward requests ranging from technical configurations to general knowledge.
ochat "What is the fibonacci sequence"
# -> The Fibonacci sequence is a series of numbers where each number ...
``
ShellGPT accepts prompt from both stdin and command line argument. Whether you prefer piping input through the terminal or specifying it directly as arguments, `ochat` got you covered. For example, you can easily generate a git commit message based on a diff:
```shell
git diff | ochat "Generate git commit message, for my changes"
# -> Added main feature details into README.md
You can analyze logs from various sources by passing them using stdin, along with a prompt. For instance, we can use it to quickly analyze logs, identify errors and get suggestions for possible solutions:
docker logs -n 20 my_app | ochat "check logs, find errors, provide possible solutions"
Error Detected: Connection timeout at line 7.
Possible Solution: Check network connectivity and firewall settings.
Error Detected: Memory allocation failed at line 12.
Possible Solution: Consider increasing memory allocation or optimizing application memory usage.
You can also use all kind of redirection operators to pass input:
ochat "summarise" < document.txt
# -> The document discusses the impact...
ochat << EOF
What is the best way to lear Golang?
Provide simple hello world example.
EOF
# -> The best way to learn Golang...
ochat <<< "What is the best way to learn shell redirects?"
# -> The best way to learn shell redirects is through...
Environment Variables
OCHAT_MODEL
Default: OCHAT_MODEL=gpt-oss
OCHAT_ENGINE_URL
Default: OCHAT_ENGINE_URL=http://localhost:11434/v1
Installation
Use Golang
go install github.com/jonfleming/ochat@latest