-
Notifications
You must be signed in to change notification settings - Fork 10
feat: implement tool calling support for workflow API #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3663aa4
4d8bfcf
b58867c
1f11793
21d07fe
c006c09
b3ae33b
929e4e9
61aac6e
cbb7441
597a48d
9d4aa6e
b565278
fddb6dd
6426159
d61145b
78c610c
84be527
0276b21
00842b0
7952b5a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,6 +1,6 @@ | ||||||
name: CI | ||||||
on: | ||||||
pull_request_target: | ||||||
pull_request: | ||||||
types: [opened, synchronize] | ||||||
push: | ||||||
branches: | ||||||
|
@@ -11,17 +11,18 @@ jobs: | |||||
runs-on: ubuntu-latest | ||||||
strategy: | ||||||
matrix: | ||||||
go-version: ["1.18", "1.19", "1.20", "1.21"] | ||||||
go-version: ["1.22", "1.23", "1.24"] | ||||||
|
||||||
steps: | ||||||
- uses: actions/checkout@v4 | ||||||
- name: Setup Go ${{ matrix.go-version }} | ||||||
uses: actions/setup-go@v4 | ||||||
with: | ||||||
go-version: ${{ matrix.go-version }} | ||||||
cache: false | ||||||
- name: Install dependencies | ||||||
run: find . -name go.mod -execdir go get . \; | ||||||
run: GOWORK=off find . -name go.mod -execdir go get . \; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace go get with go mod download/verify to avoid mutating go.mod in CI. go get . can modify go.mod/go.sum and is discouraged for installation in recent Go. Use download/verify instead. - run: GOWORK=off find . -name go.mod -execdir go get . \;
+ run: GOWORK=off find . -name go.mod -execdir sh -c 'go mod download && go mod verify' \; 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||
- name: Build | ||||||
run: find . -name go.mod -execdir go build . \; | ||||||
run: GOWORK=off find . -name go.mod -execdir go build . \; | ||||||
- name: Test | ||||||
run: find . -name go.mod -execdir go test ./... \; | ||||||
run: GOWORK=off find . -name go.mod -execdir go test ./... \; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module github.com/traceloop/go-openllmetry | ||
|
||
go 1.23 | ||
|
||
replace github.com/traceloop/go-openllmetry/traceloop-sdk => ./traceloop-sdk | ||
|
||
replace github.com/traceloop/go-openllmetry/semconv-ai => ./semconv-ai |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
go 1.21 | ||
go 1.23 | ||
|
||
use ( | ||
sample-app | ||
semconv-ai | ||
traceloop-sdk | ||
sample-app | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Sample Apps | ||
|
||
This directory contains sample applications demonstrating the Traceloop Go OpenLLMetry SDK. | ||
|
||
## OpenAI SDKs | ||
|
||
This sample app includes two different OpenAI Go SDKs for demonstration purposes: | ||
|
||
- **Sashabaranov SDK** (`github.com/sashabaranov/go-openai`) - Used in `main.go` and workflow examples | ||
- **Official OpenAI SDK** (`github.com/openai/openai-go`) - Used in `tool_calling.go` | ||
|
||
## Regular Sample | ||
|
||
Run the regular sample that demonstrates basic prompt logging: | ||
|
||
```bash | ||
go run . | ||
``` | ||
|
||
## Tool Calling Sample | ||
|
||
Run the tool calling sample that demonstrates tool calling with the OpenAI Go SDK: | ||
|
||
```bash | ||
go run . tool-calling | ||
``` | ||
|
||
### Environment Variables | ||
|
||
Set the following environment variables: | ||
|
||
```bash | ||
export OPENAI_API_KEY="your-openai-api-key" | ||
export TRACELOOP_API_KEY="your-traceloop-api-key" | ||
export TRACELOOP_BASE_URL="https://api.traceloop.com" # Optional | ||
``` | ||
|
||
### Tool Calling Features | ||
|
||
The tool calling sample demonstrates: | ||
- Request tools logging with function definitions | ||
- Response tool calls logging with execution results | ||
- Multi-turn conversations with tool execution | ||
- Complete traceability of tool calling interactions |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -1,5 +1,59 @@ | ||||||||
module github.com/traceloop/go-openllmetry/sample-app | ||||||||
|
||||||||
go 1.21 | ||||||||
go 1.23 | ||||||||
|
||||||||
require github.com/sashabaranov/go-openai v1.18.1 | ||||||||
require ( | ||||||||
github.com/joho/godotenv v1.5.1 | ||||||||
github.com/openai/openai-go v0.1.0-alpha.35 | ||||||||
github.com/sashabaranov/go-openai v1.18.1 | ||||||||
github.com/traceloop/go-openllmetry/traceloop-sdk v0.0.0-00010101000000-000000000000 | ||||||||
) | ||||||||
nirga marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
|
||||||||
require ( | ||||||||
github.com/cenkalti/backoff v2.2.1+incompatible // indirect | ||||||||
github.com/cenkalti/backoff/v4 v4.2.1 // indirect | ||||||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect | ||||||||
github.com/go-git/go-billy/v5 v5.5.0 // indirect | ||||||||
github.com/go-git/go-git/v5 v5.11.0 // indirect | ||||||||
github.com/go-logr/logr v1.4.3 // indirect | ||||||||
github.com/go-logr/stdr v1.2.2 // indirect | ||||||||
github.com/gobwas/glob v0.2.3 // indirect | ||||||||
github.com/golang/protobuf v1.5.3 // indirect | ||||||||
github.com/google/uuid v1.6.0 // indirect | ||||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect | ||||||||
github.com/hashicorp/errwrap v1.1.0 // indirect | ||||||||
github.com/hashicorp/go-multierror v1.1.1 // indirect | ||||||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect | ||||||||
github.com/jinzhu/copier v0.4.0 // indirect | ||||||||
github.com/kluctl/go-embed-python v0.0.0-3.11.6-20231002-1 // indirect | ||||||||
github.com/kluctl/go-jinja2 v0.0.0-20240108142937-8839259d2537 // indirect | ||||||||
github.com/rogpeppe/go-internal v1.13.1 // indirect | ||||||||
github.com/sirupsen/logrus v1.9.3 // indirect | ||||||||
github.com/tidwall/gjson v1.14.4 // indirect | ||||||||
github.com/tidwall/match v1.1.1 // indirect | ||||||||
github.com/tidwall/pretty v1.2.1 // indirect | ||||||||
github.com/tidwall/sjson v1.2.5 // indirect | ||||||||
github.com/traceloop/go-openllmetry/semconv-ai v0.0.0-20250405130248-6b2b4b41102b // indirect | ||||||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect | ||||||||
go.opentelemetry.io/otel v1.37.0 // indirect | ||||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 // indirect | ||||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.22.0 // indirect | ||||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 // indirect | ||||||||
go.opentelemetry.io/otel/metric v1.37.0 // indirect | ||||||||
go.opentelemetry.io/otel/sdk v1.37.0 // indirect | ||||||||
go.opentelemetry.io/otel/trace v1.37.0 // indirect | ||||||||
go.opentelemetry.io/proto/otlp v1.0.0 // indirect | ||||||||
golang.org/x/net v0.27.0 // indirect | ||||||||
golang.org/x/sync v0.7.0 // indirect | ||||||||
golang.org/x/sys v0.33.0 // indirect | ||||||||
golang.org/x/text v0.16.0 // indirect | ||||||||
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect | ||||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect | ||||||||
google.golang.org/grpc v1.60.1 // indirect | ||||||||
google.golang.org/protobuf v1.32.0 // indirect | ||||||||
gopkg.in/warnings.v0 v0.1.2 // indirect | ||||||||
) | ||||||||
|
||||||||
replace github.com/traceloop/go-openllmetry/traceloop-sdk => ../traceloop-sdk | ||||||||
|
||||||||
replace github.com/traceloop/go-openllmetry/semconv-ai => ../semconv-ai | ||||||||
Comment on lines
+57
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainPrefer a Local replaces are fine for development, but a Check if a workspace file exists: If adopting
🏁 Script executed: #!/bin/bash
fd -a go.work Length of output: 73 To confirm that the workspace already includes the local modules (so we can safely drop those 🏁 Script executed: #!/bin/bash
echo "=== go.work ==="
cat go.work Length of output: 112 Remove redundant replace directives in sample-app/go.mod Since your go.work already includes • File: sample-app/go.mod - replace github.com/traceloop/go-openllmetry/traceloop-sdk => ../traceloop-sdk
- replace github.com/traceloop/go-openllmetry/semconv-ai => ../semconv-ai 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrade actions/setup-go to v5 (actionlint warning).
actionlint flags v4 as too old on current runners. Upgrade to v5.
📝 Committable suggestion
🧰 Tools
🪛 actionlint (1.7.7)
19-19: the runner of "actions/setup-go@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🤖 Prompt for AI Agents