This PR is to remove the `NewGenericTool` function within tools.
This function was previously added when we are trying to consolidate the
three postgres tools. However, since we merged it into a single
`postgressql` tool, these functions are not used anymore.
User agent will be set as "genai-toolbox/" + versionString.
Instead of a panic, Toolbox will throw an error if the source fail to
retrieve `user agent`.
This will also be consistent with setting and getting logger from
context.
Update `spanner-sql` kind in example. It was previously updated
throughout the doc, except for the example.
It should be `spanner-sql` instead of `spanner`.
Fixes#302
Rename existing `authSource` to `authService` through deprecation.
`AuthService` more clearly distinguishes it from `Sources` objects.
`authSources` will be converted into `authServices` after the
unmarshalling process. A warning log is shown if `authSources` are used
(for both within tools parameters and defining auth services):
```
2025-02-20T13:57:51.156025-08:00 WARN "`authSources` is deprecated, use `authServices` for parameters instead"
2025-02-20T13:57:51.156569-08:00 WARN "`authSources` is deprecated, use `authServices` instead"
2025-02-20T13:57:52.047584-08:00 INFO "Initialized 1 sources."
...
```
The manifest generated will continue to use `authSources` to keep
compatibility with the sdks:
```
{
"serverVersion":"0.1.0",
"tools":{
"test_tool2":{
"description":"Use this tool to test\n",
"parameters":[{
"name":"user_id",
"type":"string",
"description":"Auto-populated from Google login",
"authSources":["my-google-auth"]
}]
}
}
}
```
Test cases with `authSources` are kept for compatibility. Will be
removed when `authSources` are no longer supported.
Check common parameters for required fields. Throw an error if name or
description is not provided.
Example of error when `description` field not provided:
```
2025-02-18T14:11:55.475101-08:00 ERROR "unable to parse tool file at \"tools.yaml\": unable to parse as \"postgres-sql\": unable to parse as \"array\": Key: 'CommonParameter.Desc' Error:Field validation for 'Desc' failed on the 'required' tag"
```
Fixes#291 by throwing a more descriptive error when items field is not provided.
Example of error when `items` field not provided for array parameter:
```
2025-02-18T14:07:58.77173-08:00 ERROR "unable to parse tool file at \"tools.yaml\": unable to parse as \"postgres-sql\": unable to parse as \"array\": unable to parse 'items' field: error parsing parameters: nothing to unmarshal"
```
`items` are not specified in the manifest for parameters, which means
the client doesn't parse them correctly when presented to the LLMs. This
PR adds `items` as part of manifest.
Example manifest:
```
{
"serverVersion": "0.1.0",
"tools": {
"tool_name": {
"description": "description of the tool...",
"parameters": [{
"name": "foos",
"type": "array",
"description": "A list of foo.",
"authSources": [],
"items": {"name": "foo", "type": "string", "description": "foobar.", "authSources": []}
}]
}
}
}
```
Fixes#292🦕
Reorganize integration tests, mainly between postgres, mysql, and sql
server that shares alot similar code.
* separate commons_test.go to multiple file:
* server_test.go: for setting up server etc.
* tool_test.go: for testing tools endpoint, including testing tools with
parameters or auth-invokes
* source_test.go: for testing source such as connection tests or setting
up source-related code
* auth_test.go: only contain auth set up related code
* common_test.go: consist of common and general set up such as getting
tools config etc.
* Move `switch-case` into individual source's test file so common files
only contains code that don't need to be altered when adding new
integration test. This will ease future debugging and adding new tests.
The following integration tests are not updated (does not have testing
of tool invoke with parameters):
- dgraph
- neo4j
- spanner (will require more changes, will update in a separate PR)
This PR also does not re-organize `tests/` folder structure.
Add the bash command to `pip install` the package directly in the README
for a quicker start.
Also add “SDK” after “Toolbox LangChain” to clearly show that “Toolbox
LangChain” is an SDK.
> [!NOTE]
> We had released the PyPI package for Toolbox LangChain SDK as
`toolbox-langchain` and not `toolbox-langchain-sdk` but it still makes
sense to call it “Toolbox LangChain SDK” in natural language.