-
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.
✨ fix module added with initial trials #20
- Loading branch information
Showing
7 changed files
with
112 additions
and
2 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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM codellama:7b | ||
|
||
PARAMETER temperature 0.1 | ||
PARAMETER top_p 0.5 | ||
PARAMETER top_k 40 | ||
PARAMETER seed 1 | ||
|
||
SYSTEM You are software program specifically for Command Line Interface usage. Users will provide you a console output of an executed command and you will try to fix the errored command. You are designed to be helpful and informative. You are not a chatbot, so you will not engage in conversation. You will only respond to given executed command output. |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package fix | ||
|
||
import ( | ||
"bufio" | ||
"fmt" | ||
"os" | ||
"strings" | ||
) | ||
|
||
func (f *Fix) fixPrompt() error { | ||
fmt.Println(os.Args) | ||
// Create a scanner to read from standard input | ||
scanner := bufio.NewScanner(os.Stdin) | ||
|
||
// Use a StringBuilder to concatenate all input lines | ||
var builder strings.Builder | ||
|
||
for scanner.Scan() { | ||
builder.WriteString(scanner.Text()) | ||
builder.WriteString("\n") | ||
} | ||
|
||
// Get the complete input as a string | ||
pipedInput := builder.String() | ||
fmt.Println(pipedInput) | ||
|
||
fmt.Println("fix -> action") | ||
|
||
return nil | ||
} |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package fix | ||
|
||
import ( | ||
"fmt" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
func (f *Fix) action(_ *cli.Context) error { | ||
return f.fixPrompt() | ||
} | ||
|
||
func (f *Fix) before(_ *cli.Context) error { | ||
fmt.Println("fix -> before") | ||
return nil | ||
} | ||
|
||
func (f *Fix) Command() *cli.Command { | ||
return &cli.Command{ | ||
Name: "fix", | ||
Usage: "Fixes a failed command", | ||
Aliases: []string{"f"}, | ||
Action: f.action, | ||
Before: f.before, | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package fix | ||
|
||
import ( | ||
_ "embed" | ||
"fmt" | ||
ollama "github.com/jmorganca/ollama/api" | ||
) | ||
|
||
//go:embed Modelfile.fix | ||
var fixModelfile string | ||
|
||
type Fix struct { | ||
api *ollama.Client | ||
|
||
tag string | ||
modelfile string | ||
} | ||
|
||
func (f *Fix) Tag() string { | ||
return f.tag | ||
} | ||
|
||
func (f *Fix) Modelfile() string { | ||
return f.modelfile | ||
} | ||
|
||
func New(api *ollama.Client, version string) *Fix { | ||
tag := fmt.Sprintf("tlm:%s-f", version) | ||
return &Fix{api: api, tag: tag, modelfile: fixModelfile} | ||
} |
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