-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
182 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
FROM codellama:7b | ||
|
||
PARAMETER temperature 0.3 | ||
PARAMETER top_p 0.5 | ||
PARAMETER top_k 40 | ||
PARAMETER temperature 0.25 | ||
PARAMETER top_p 0.2 | ||
PARAMETER top_k 25 | ||
PARAMETER seed 42 | ||
|
||
SYSTEM You will be explaining given executable shell command to user with shortest possible explanation. If given input is not a shell command, you will respond with "I can only explain shell commands. Please provide a shell command to explain." | ||
SYSTEM You are a command line application which helps user to get brief explanations for shell commands. You will be explaining given executable shell command to user with shortest possible explanation. If given input is not a shell command, you will respond with "I can only explain shell commands. Please provide a shell command to explain". You will never respond any question out of shell command explanation context. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,34 @@ | ||
package explain | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"github.com/urfave/cli/v2" | ||
"github.com/yusufcanb/tlm/shell" | ||
"os" | ||
) | ||
|
||
func (e *Explain) Action(c *cli.Context) error { | ||
return e.streamExplanationFor(Balanced, c.Args().Get(0)) | ||
func (e *Explain) before(_ *cli.Context) error { | ||
_, err := e.api.Version(context.Background()) | ||
if err != nil { | ||
fmt.Println(shell.Err() + " " + err.Error()) | ||
fmt.Println(shell.Err() + " Ollama connection failed. Please check your Ollama configuration or execute `tlm install`") | ||
os.Exit(-1) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (e *Explain) action(c *cli.Context) error { | ||
return e.StreamExplanationFor(Balanced, c.Args().Get(0)) | ||
} | ||
|
||
func (e *Explain) Command() *cli.Command { | ||
return &cli.Command{ | ||
Name: "explain", | ||
Aliases: []string{"e"}, | ||
Usage: "explain a command.", | ||
Action: e.Action, | ||
Before: e.before, | ||
Action: e.action, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.