Commit Graph

26 Commits

Author SHA1 Message Date
Kurtis Van Gent
66ab70f702 fix: handle shutdown gracefully (#178)
Adds logic to make the server shutdown gracefully, including better
respecting cancelled contexts and providing up to 10 seconds to finish
current connections.
2024-12-31 09:53:53 -07:00
Yuan
809e547a48 feat: update log with given context (#147)
Update logging with the given context.
2024-12-23 19:55:25 -08:00
release-please[bot]
21a9146404 chore(main): release 0.0.4 (#153)
🤖 I have created a release *beep* *boop*
---


##
[0.0.4](https://github.com/googleapis/genai-toolbox/compare/v0.0.3...v0.0.4)
(2024-12-18)


### Features

* Add `auth_required` to tools
([#123](https://github.com/googleapis/genai-toolbox/issues/123))
([3118104](3118104ae1))
* Add Auth Source configuration
([#71](https://github.com/googleapis/genai-toolbox/issues/71))
([77b0d43](77b0d43175))
* Add Tool authenticated parameters
([#80](https://github.com/googleapis/genai-toolbox/issues/80))
([380a6fb](380a6fbbd5))
* **langchain-sdk:** Correctly parse Manifest API response as JSON
([#143](https://github.com/googleapis/genai-toolbox/issues/143))
([2c8633c](2c8633c3eb))
* **langchain-sdk:** Support authentication in LangChain Toolbox SDK.
([#133](https://github.com/googleapis/genai-toolbox/issues/133))
([23fa912](23fa912a80))


### Bug Fixes

* Fix release image version tag
([#136](https://github.com/googleapis/genai-toolbox/issues/136))
([6d19ff9](6d19ff96e4))
* **langchain-sdk:** Correct test name to ensure execution and full
coverage.
([#145](https://github.com/googleapis/genai-toolbox/issues/145))
([d820ac3](d820ac3767))
* Set server version
([#150](https://github.com/googleapis/genai-toolbox/issues/150))
([abd1eb7](abd1eb702c))


### Miscellaneous Chores

* Release 0.0.4
([#152](https://github.com/googleapis/genai-toolbox/issues/152))
([86ec12f](86ec12f8c5))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
2024-12-18 18:48:13 -05:00
Wenxin Du
abd1eb702c fix: Set server version (#150) 2024-12-18 17:15:55 -05:00
Wenxin Du
3118104ae1 feat: add auth_required to tools (#123)
Check if a tool invocation request contains required auth token.
2024-12-16 22:41:13 -05:00
Wenxin Du
380a6fbbd5 feat: Add Tool authenticated parameters (#80)
1. Add []ParamAuthSource to every Parameter type implementation to
support authenticated configs. Create new constructors for types with
auth.
2. Tool invocation API changes to parse auth header and authentecated
parameters.
3. Add authSources to Tool manifest.
2024-12-16 17:46:06 -05:00
Wenxin Du
77b0d43175 feat: Add Auth Source configuration (#71)
1. Add authentication source configs to Toolbox server.
2. Add Google auth implementation.
2024-12-13 12:22:42 -05:00
release-please[bot]
504fbf508b chore(main): release 0.0.3 (#75)
🤖 I have created a release *beep* *boop*
---


##
[0.0.3](https://github.com/googleapis/genai-toolbox/compare/v0.0.2...v0.0.3)
(2024-12-10)


### Features

* Add --log-level and --logging-format flags
([#97](https://github.com/googleapis/genai-toolbox/issues/97))
([9a0f618](9a0f618efc))
* Add options for command
([#110](https://github.com/googleapis/genai-toolbox/issues/110))
([5c690c5](5c690c5c30))
* Add Spanner source and tool
([#90](https://github.com/googleapis/genai-toolbox/issues/90))
([890914a](890914aae0))
* Add std logger
([#95](https://github.com/googleapis/genai-toolbox/issues/95))
([6a8feb5](6a8feb51f0))
* Add structured logger
([#96](https://github.com/googleapis/genai-toolbox/issues/96))
([5e20417](5e20417551))
* **source/alloydb-pg:** Add configuration for public and private IP
([#103](https://github.com/googleapis/genai-toolbox/issues/103))
([e88ec40](e88ec409d1))
* **source/cloudsql-pg:** Add configuration for public and private IP
([#114](https://github.com/googleapis/genai-toolbox/issues/114))
([6479c1d](6479c1dbe2))


### Bug Fixes

* Fix go test workflow
([#84](https://github.com/googleapis/genai-toolbox/issues/84))
([8c2c373](8c2c373d35))
* Fix issue causing client session to not close properly while closing
SDK. ([#81](https://github.com/googleapis/genai-toolbox/issues/81))
([9d360e1](9d360e16ea))
* Fix test cases for ip_type
([#115](https://github.com/googleapis/genai-toolbox/issues/115))
([5528bec](5528bec8ed))
* Fix the errors showing up after setting up mypy type checker.
([#74](https://github.com/googleapis/genai-toolbox/issues/74))
([522bbef](522bbefa7b))
* **llamaindex-sdk:** Fix issue causing client session to not close
properly while closing SDK.
([#82](https://github.com/googleapis/genai-toolbox/issues/82))
([fa03376](fa03376bbc))


### Miscellaneous Chores

* Release 0.0.3
([#122](https://github.com/googleapis/genai-toolbox/issues/122))
([626e12f](626e12fdb3))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
2024-12-09 19:39:11 -05:00
Yuan
45a38ca9f0 chore: separate listen and server into two functions (#121)
Separate listen and server into two distinct functions to prevent race
condition during testing.
2024-12-09 22:57:53 +00:00
Yuan
3df68f1b69 chore: set out and err io.Writer during initialization (#112)
Logger might be created pre- or post- flag. The logger defined pre- and
post- flag should be using the same out and err writer.

This will ensure that the server uses the same out and err writer
defined with the `WithStreams` options.
2024-12-05 16:14:43 -08:00
Yuan
6479c1dbe2 feat(source/cloudsql-pg): add configuration for public and private IP (#114)
Allow user to set if their database uses private or public ip. The
reason we add this is because the dialer require different
initialization with private and public ip.

By default, toolbox will use public ip.
2024-12-06 00:08:15 +00:00
Yuan
5c690c5c30 feat: add options for command (#110)
Add Option to configure a Command.

Currently we are only supporting `WithLogger` Option.
2024-12-05 09:02:47 -08:00
Yuan
9a0f618efc feat: add --log-level and --logging-format flags (#97)
Logging support 4 different types of logging (debug, info, warn, error).
The default logging level is Info.

User will be able to set flag for log level (allowed values: "debug",
"info", "warn", "error"), example:
`go run . --log-level debug`

User will be able to set flag for logging format (allowed values:
"standard", "JSON"), example:
`go run . --logging-format json`

**sample http request log - std:**
server
```
2024-11-12T15:08:11.451377-08:00 INFO "Initalized 0 sources.\n"
```
httplog
```
2024-11-26T15:15:53.947287-08:00 INFO Response: 200 OK service: "httplog" httpRequest: {url: "http://127.0.0.1:5000/" method: "GET" path: "/" remoteIP: "127.0.0.1:64216" proto: "HTTP/1.1" requestID: "macbookpro.roam.interna/..." scheme: "http" header: {user-agent: "curl/8.7.1" accept: "*/*"}} httpResponse: {status: 200 bytes: 22 elapsed: 0.012417}
```

**sample http request log - structured:**
server
```
{
  "timestamp":"2024-11-04T16:45:11.987299-08:00",
  "severity":"ERROR",
  "logging.googleapis.com/sourceLocation":{
    "function":"github.com/googleapis/genai-toolbox/internal/log.(*StructuredLogger).Errorf",
    "file":"/Users/yuanteoh/github/genai-toolbox/internal/log/log.go","line":157
  },
  "message":"unable to parse tool file at \"tools.yaml\": \"cloud-sql-postgres1\" is not a valid kind of data source"
}
```
httplog
```
{
  "timestamp":"2024-11-26T15:12:49.290974-08:00",
  "severity":"INFO",
  "logging.googleapis.com/sourceLocation":{
      "function":"github.com/go-chi/httplog/v2.(*RequestLoggerEntry).Write",
      "file":"/Users/yuanteoh/go/pkg/mod/github.com/go-chi/httplog/v2@v2.1.1/httplog.go","line":173
  },
  "message":"Response: 200 OK",
  "service":"httplog",
  "httpRequest":{
      "url":"http://127.0.0.1:5000/",
      "method":"GET",
      "path":"/",
      "remoteIP":"127.0.0.1:64140",
      "proto":"HTTP/1.1",
      "requestID":"yuanteoh-macbookpro.roam.internal/NBrtYBu3q9-000001",
      "scheme":"http",
      "header":{"user-agent":"curl/8.7.1","accept":"*/*"}
  },
  "httpResponse":{"status":200,"bytes":22,"elapsed":0.0115}
}
```
2024-12-03 16:52:19 +00:00
release-please[bot]
8a6ec6042c chore(main): release 0.0.2 (#35)
🤖 I have created a release *beep* *boop*
---


##
[0.0.2](https://github.com/googleapis/genai-toolbox/compare/v0.0.1...v0.0.2)
(2024-11-12)


### ⚠ BREAKING CHANGES

* consolidate "x-postgres-generic" tools to "postgres-sql" tool
([#43](https://github.com/googleapis/genai-toolbox/issues/43))

### Features

* Consolidate "x-postgres-generic" tools to "postgres-sql" tool
([#43](https://github.com/googleapis/genai-toolbox/issues/43))
([f630965](f630965937))
* **container:** Add entrypoint in Dockerfile
([#38](https://github.com/googleapis/genai-toolbox/issues/38))
([b08072a](b08072a800))
* LlamaIndex SDK
([#48](https://github.com/googleapis/genai-toolbox/issues/48))
([b824abe](b824abe72f))
* **sdk:** Make ClientSession optional when initializing ToolboxClient
([#55](https://github.com/googleapis/genai-toolbox/issues/55))
([26347b5](26347b5a5e))
* Support requesting a single tool
([#56](https://github.com/googleapis/genai-toolbox/issues/56))
([efafba9](efafba9033))


### Bug Fixes

* Correct source type validation for postgres-sql tool
([#47](https://github.com/googleapis/genai-toolbox/issues/47))
([52ebb43](52ebb431b7))
* **docs:** Correct outdated references to tool kinds
([#49](https://github.com/googleapis/genai-toolbox/issues/49))
([972888b](972888b9d6))
* Handle content-type correctly
([#33](https://github.com/googleapis/genai-toolbox/issues/33))
([cf8112f](cf8112f856))


### Miscellaneous Chores

* Release 0.0.2
([#65](https://github.com/googleapis/genai-toolbox/issues/65))
([beea3c3](beea3c32d9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com>
2024-11-12 21:04:09 +00:00
Kurtis Van Gent
f630965937 feat!: consolidate "x-postgres-generic" tools to "postgres-sql" tool (#43)
This PR introduces the following breaking change: The
`alloydb-pg-generic`, `cloud-sql-pg-generic`, and
`postgres-generic-tool` have been replaced by the `postgres-sql` tool,
which works with all 3 Postgres sources.

If you were using of the the previous tools, you will need to update it
as follows:
```diff
example_tool:
-    kind: cloud-sql-pg-generic
+    kind: postgres-sql
     source: my-cloud-sql-pg-instance
     description: some description
        statement: |
            SELECT * FROM SQL_STATEMENT;
        parameters:
        - name: country
          type: string
          description: some description
```

I'm proposing this change for the following reasons:
1. It provides greater flexibility between postgres-compatible sources
-- you can change between "postgres" and "alloydb-postgres" without
issue
2. The name "postgres-sql" is more clear that "postgres-generic" -- it
indicates it's a tool that runs SQL on the source
3. It's easier for us to maintain feature compatibility across a single
"postgres-sql" tool
2024-11-01 16:17:18 -07:00
Kurtis Van Gent
efe9e8bc97 chore: refactor sources/tools each into their own package (#42)
Moves all of the "source" and "tool" implementations into their own
packages. This layout makes it a bit more clear where the
implementations are, and seems likely to scale more cleanly as more
sources and tools are added.
2024-11-01 16:44:13 -06:00
release-please[bot]
7e8b870d35 chore(main): release 0.0.1 (#16)
🤖 I have created a release *beep* *boop*
---


## 0.0.1 (2024-10-28)


### Features

* Add address and port flags
([#7](https://github.com/googleapis/genai-toolbox/issues/7))
([df9ad9e](df9ad9e33f))
* Add AlloyDB source and tool
([#23](https://github.com/googleapis/genai-toolbox/issues/23))
([fe92d02](fe92d02ae2))
* Add basic CLI
([#5](https://github.com/googleapis/genai-toolbox/issues/5))
([1539ee5](1539ee56dd))
* Add basic http server
([#6](https://github.com/googleapis/genai-toolbox/issues/6))
([e09ae30](e09ae30a90))
* Add basic parsing from tools file
([#8](https://github.com/googleapis/genai-toolbox/issues/8))
([b9ba364](b9ba364fb6))
* Add initial cloud sql pg invocation
([#14](https://github.com/googleapis/genai-toolbox/issues/14))
([3703176](3703176fce))
* Add Postgres source and tool
([#25](https://github.com/googleapis/genai-toolbox/issues/25))
([2742ed4](2742ed48b8))
* Add preliminary parsing of parameters
([#13](https://github.com/googleapis/genai-toolbox/issues/13))
([27edd3b](27edd3b5f6))
* Add support for array type parameters
([#26](https://github.com/googleapis/genai-toolbox/issues/26))
([3903e86](3903e860bc))
* Add toolset configuration
([#12](https://github.com/googleapis/genai-toolbox/issues/12))
([59b4bc0](59b4bc07f4))
* Add Toolset manifest endpoint
([#11](https://github.com/googleapis/genai-toolbox/issues/11))
([61e7b78](61e7b78ad8))
* **langchain-sdk:** Add Toolbox SDK for LangChain
([#22](https://github.com/googleapis/genai-toolbox/issues/22))
([0bcd4b6](0bcd4b6e41))
* Stub basic control plane functionality
([#9](https://github.com/googleapis/genai-toolbox/issues/9))
([336bdc4](336bdc4d56))


### Miscellaneous Chores

* Release 0.0.1
([#31](https://github.com/googleapis/genai-toolbox/issues/31))
([1f24ddd](1f24dddb4b))


### Continuous Integration

* Add realease-please
([#15](https://github.com/googleapis/genai-toolbox/issues/15))
([17fbbb4](17fbbb49b0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
2024-10-28 10:31:23 -06:00
Kurtis Van Gent
de14c6f669 chore: refactor parameters logic to allow for more complex functionality (#24)
Refactors parameter logic to allow for more complex functionality (e.g.
arrays) in the future.

---------

Co-authored-by: Wenxin Du <117315983+duwenxin99@users.noreply.github.com>
2024-10-23 13:04:10 -06:00
Wenxin Du
61e7b78ad8 feat: Add Toolset manifest endpoint (#11)
1. Calculate tool manifests when server starts.
2. Add toolset manifest endpoints.

---------

Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com>
2024-10-17 18:43:58 -04:00
Wenxin Du
59b4bc07f4 feat: add toolset configuration (#12)
Add `Toolset` implementation to the `tools` package:
- struct and configs.
- Custom `UnmarshalYAML` function.
- Initialization function that validates if tools specified for the
toolset exist.
2024-10-11 14:11:05 -04:00
Kurtis Van Gent
27edd3b5f6 feat: add preliminary parsing of parameters (#13)
This PR adds preliminary parsing of parameters. Currently it only
supports 4 types: string, int, float32, and bool. Almost certainly we
will need to introduce more complicated parsing configuration (to handle
objects and arrays), but my initial attempts got quickly complicated, so
I simplified in the short term.

This also makes 2 breaking changes to config.yaml:
- changes "parameters" to be a list over object -- this is because
parameter ordering is important, and needs to be preserved
- removed the "required" field from parameter objects -- we need to
determine how to handle optional parameters in SQL queries
2024-10-08 15:18:49 -06:00
Kurtis Van Gent
336bdc4d56 feat: stub basic control plane functionality (#9)
Stub's out some basic control plane functionality. This also required
setting up some Source and Tools initialization.
2024-09-20 14:12:16 -06:00
Kurtis Van Gent
b9ba364fb6 feat: add basic parsing from tools file (#8) 2024-08-05 09:33:07 -06:00
Kurtis Van Gent
df9ad9e33f feat: add address and port flags (#7)
Add flags for setting the address and port of the server.
2024-07-30 10:55:13 -05:00
Kurtis Van Gent
e09ae30a90 feat: add basic http server (#6) 2024-07-26 16:59:01 -05:00
Kurtis Van Gent
1539ee56dd feat: add basic CLI (#5) 2024-07-15 11:12:29 -06:00