mirror of
https://github.com/coalaura/whiskr.git
synced 2025-09-08 00:29:54 +00:00
wip
This commit is contained in:
9
chat.go
9
chat.go
@@ -145,11 +145,14 @@ func (r *Request) Parse() (*openrouter.ChatCompletionRequest, error) {
|
||||
request.Messages = append(request.Messages, openrouter.SystemMessage(prompt))
|
||||
}
|
||||
|
||||
if model.Tools && r.Tools.Search && env.Tokens.Exa != "" {
|
||||
if model.Tools && r.Tools.Search && env.Tokens.Exa != "" && r.Iterations > 1 {
|
||||
request.Tools = GetSearchTools()
|
||||
request.ToolChoice = "auto"
|
||||
|
||||
request.Messages = append(request.Messages, openrouter.SystemMessage(InternalToolsPrompt))
|
||||
request.Messages = append(
|
||||
request.Messages,
|
||||
openrouter.SystemMessage(fmt.Sprintf(InternalToolsPrompt, r.Iterations-1)),
|
||||
)
|
||||
}
|
||||
|
||||
for _, message := range r.Messages {
|
||||
@@ -273,7 +276,7 @@ func HandleChat(w http.ResponseWriter, r *http.Request) {
|
||||
for iteration := range raw.Iterations {
|
||||
debug("iteration %d of %d", iteration+1, raw.Iterations)
|
||||
|
||||
if iteration == raw.Iterations-1 {
|
||||
if len(request.Tools) > 0 && iteration == raw.Iterations-1 {
|
||||
debug("no more tool calls")
|
||||
|
||||
request.Tools = nil
|
||||
|
@@ -1 +1,3 @@
|
||||
You have access to web search tools. Use `search_web` with `query` (string) and `num_results` (1-10) to find current information - when searching for recent/latest information, always include specific dates or years (e.g., "august 2025"). Use `fetch_contents` with `urls` (array) to read full page content from search results or known URLs. Use `github_repository` with `owner` (string) and `repo` (string) to get repository overviews (info, branches, files, README) without cloning. Formulate specific, targeted queries and provide all required parameters. Call only one tool per response.
|
||||
You have access to web search tools. Use `search_web` with `query` (string) and `num_results` (1-10) to find current information - when searching for recent/latest information, always include specific dates or years (e.g., "august 2025"). Use `fetch_contents` with `urls` (array) to read full page content from search results or known URLs. Use `github_repository` with `owner` (string) and `repo` (string) to get repository overviews (info, branches, files, README) without cloning. Formulate specific, targeted queries and provide all required parameters. Call only one tool per response.
|
||||
|
||||
You have %d tool calls available in total.
|
Reference in New Issue
Block a user