mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-02-04 04:05:22 -05:00
Compare commits
8 Commits
link-check
...
err
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c5285c5c8 | ||
|
|
ac544d0878 | ||
|
|
54f9a3d312 | ||
|
|
62d96a662d | ||
|
|
46244458c4 | ||
|
|
b6fa798610 | ||
|
|
bb58baff70 | ||
|
|
32b2c9366d |
24
.github/workflows/link_checker_workflow.yaml
vendored
24
.github/workflows/link_checker_workflow.yaml
vendored
@@ -32,37 +32,29 @@ jobs:
|
|||||||
restore-keys: cache-lychee-
|
restore-keys: cache-lychee-
|
||||||
|
|
||||||
- name: Link Checker
|
- name: Link Checker
|
||||||
id: lychee-check
|
|
||||||
uses: lycheeverse/lychee-action@a8c4c7cb88f0c7386610c35eb25108e448569cb0 # v2
|
uses: lycheeverse/lychee-action@a8c4c7cb88f0c7386610c35eb25108e448569cb0 # v2
|
||||||
continue-on-error: true
|
|
||||||
with:
|
with:
|
||||||
args: >
|
args: >
|
||||||
--quiet
|
--verbose
|
||||||
--no-progress
|
--no-progress
|
||||||
--cache
|
--cache
|
||||||
--max-cache-age 1d
|
--max-cache-age 1d
|
||||||
--exclude '^neo4j\+.*' --exclude '^bolt://.*'
|
--exclude '^neo4j\+.*' --exclude '^bolt://.*'
|
||||||
README.md
|
README.md
|
||||||
docs/
|
docs/
|
||||||
output: lychee-report.md
|
output: /tmp/foo.txt
|
||||||
format: markdown
|
|
||||||
fail: true
|
fail: true
|
||||||
jobSummary: false
|
jobSummary: true
|
||||||
debug: false
|
debug: true
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# This step only runs if the 'lychee_check' step fails, ensuring the
|
||||||
- name: Display Failure Report
|
# context note only appears when the developer needs to troubleshoot.
|
||||||
# Run this ONLY if the link checker failed
|
- name: Display Link Context Note on Failure
|
||||||
if: steps.lychee-check.outcome == 'failure'
|
if: ${{ failure() }}
|
||||||
run: |
|
run: |
|
||||||
echo "## Link Resolution Note" >> $GITHUB_STEP_SUMMARY
|
echo "## Link Resolution Note" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "Local links and directory changes work differently on GitHub than on the docsite." >> $GITHUB_STEP_SUMMARY
|
echo "Local links and directory changes work differently on GitHub than on the docsite." >> $GITHUB_STEP_SUMMARY
|
||||||
echo "You must ensure fixes pass the **GitHub check** and also work with **\`hugo server\`**." >> $GITHUB_STEP_SUMMARY
|
echo "You must ensure fixes pass the **GitHub check** and also work with **\`hugo server\`**." >> $GITHUB_STEP_SUMMARY
|
||||||
echo "See [Link Checking and Fixing with Lychee](https://github.com/googleapis/genai-toolbox/blob/main/DEVELOPER.md#link-checking-and-fixing-with-lychee) for more details." >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "---" >> $GITHUB_STEP_SUMMARY
|
echo "---" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
echo "### Broken Links Found" >> $GITHUB_STEP_SUMMARY
|
|
||||||
cat ./lychee-report.md >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
exit 1
|
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ https://cloud.dgraph.io/login
|
|||||||
https://dgraph.io/docs
|
https://dgraph.io/docs
|
||||||
|
|
||||||
# MySQL Community downloads and main site (often protected by bot mitigation)
|
# MySQL Community downloads and main site (often protected by bot mitigation)
|
||||||
^https?://(.*\.)?mysql\.com/.*
|
https://dev.mysql.com/downloads/installer/
|
||||||
|
https://www.mysql.com/
|
||||||
|
|
||||||
# Claude desktop download link
|
# Claude desktop download link
|
||||||
https://claude.ai/download
|
https://claude.ai/download
|
||||||
@@ -36,8 +37,8 @@ https://dev.mysql.com/doc/refman/8.4/en/sql-prepared-statements.html
|
|||||||
https://dev.mysql.com/doc/refman/8.4/en/user-names.html
|
https://dev.mysql.com/doc/refman/8.4/en/user-names.html
|
||||||
|
|
||||||
# npmjs links can occasionally trigger rate limiting during high-frequency CI builds
|
# npmjs links can occasionally trigger rate limiting during high-frequency CI builds
|
||||||
^https?://(www\.)?npmjs\.com/.*
|
https://www.npmjs.com/package/@toolbox-sdk/core
|
||||||
|
https://www.npmjs.com/package/@toolbox-sdk/adk
|
||||||
https://www.oceanbase.com/
|
https://www.oceanbase.com/
|
||||||
|
|
||||||
# Ignore social media and blog profiles to reduce external request overhead
|
# Ignore social media and blog profiles to reduce external request overhead
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export async function main() {
|
|||||||
|
|
||||||
for (const query of queries) {
|
for (const query of queries) {
|
||||||
conversationHistory.push({ role: "user", content: [{ text: query }] });
|
conversationHistory.push({ role: "user", content: [{ text: query }] });
|
||||||
let response = await ai.generate({
|
const response = await ai.generate({
|
||||||
messages: conversationHistory,
|
messages: conversationHistory,
|
||||||
tools: tools,
|
tools: tools,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ The `invoke` command allows you to invoke tools defined in your configuration di
|
|||||||
|
|
||||||
{{< notice tip >}}
|
{{< notice tip >}}
|
||||||
**Keep configurations minimal:** The `invoke` command initializes *all* resources (sources, tools, etc.) defined in your configuration files during execution. To ensure fast response times, consider using a minimal configuration file containing only the tools you need for the specific invocation.
|
**Keep configurations minimal:** The `invoke` command initializes *all* resources (sources, tools, etc.) defined in your configuration files during execution. To ensure fast response times, consider using a minimal configuration file containing only the tools you need for the specific invocation.
|
||||||
{{< /notice >}}
|
{{< notice tip >}}
|
||||||
|
|
||||||
## Before you begin
|
## Prerequisites
|
||||||
|
|
||||||
1. Make sure you have the `toolbox` binary installed or built.
|
- You have the `toolbox` binary installed or built.
|
||||||
2. Make sure you have a valid tool configuration file (e.g., `tools.yaml`).
|
- You have a valid tool configuration file (e.g., `tools.yaml`).
|
||||||
|
|
||||||
## Basic Usage
|
## Basic Usage
|
||||||
|
|
||||||
|
|||||||
61
internal/util/errors.go
Normal file
61
internal/util/errors.go
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
// Copyright 2026 Google LLC
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
package util
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
type ErrorCategory string
|
||||||
|
|
||||||
|
const (
|
||||||
|
CategoryAgent ErrorCategory = "AGENT_ERROR"
|
||||||
|
CategoryServer ErrorCategory = "SERVER_ERROR"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ToolboxError is the interface all custom errors must satisfy
|
||||||
|
type ToolboxError interface {
|
||||||
|
error
|
||||||
|
Category() ErrorCategory
|
||||||
|
}
|
||||||
|
|
||||||
|
// Agent Errors return 200 to the sender
|
||||||
|
type AgentError struct {
|
||||||
|
Msg string
|
||||||
|
Cause error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *AgentError) Error() string { return e.Msg }
|
||||||
|
|
||||||
|
func (e *AgentError) Category() ErrorCategory { return CategoryAgent }
|
||||||
|
|
||||||
|
func (e *AgentError) Unwrap() error { return e.Cause }
|
||||||
|
|
||||||
|
func NewAgentError(msg string, cause error) *AgentError {
|
||||||
|
return &AgentError{Msg: msg, Cause: cause}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientServerError returns 4XX/5XX error code
|
||||||
|
type ClientServerError struct {
|
||||||
|
Msg string
|
||||||
|
Code int
|
||||||
|
Cause error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *ClientServerError) Error() string { return fmt.Sprintf("%s: %v", e.Msg, e.Cause) }
|
||||||
|
|
||||||
|
func (e *ClientServerError) Category() ErrorCategory { return CategoryServer }
|
||||||
|
|
||||||
|
func (e *ClientServerError) Unwrap() error { return e.Cause }
|
||||||
|
|
||||||
|
func NewClientServerError(msg string, code int, cause error) *ClientServerError {
|
||||||
|
return &ClientServerError{Msg: msg, Code: code, Cause: cause}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user