MCPcopy Index your code
hub / github.com/coder/coder / AIBridgeToolUsage

Function AIBridgeToolUsage

coderd/database/dbgen/dbgen.go:2011–2035  ·  view source on GitHub ↗
(t testing.TB, db database.Store, seed database.InsertAIBridgeToolUsageParams)

Source from the content-addressed store, hash-verified

2009}
2010
2011func AIBridgeToolUsage(t testing.TB, db database.Store, seed database.InsertAIBridgeToolUsageParams) database.AIBridgeToolUsage {
2012 serverURL := sql.NullString{}
2013 if seed.ServerUrl.Valid {
2014 serverURL = seed.ServerUrl
2015 }
2016 invocationError := sql.NullString{}
2017 if seed.InvocationError.Valid {
2018 invocationError = seed.InvocationError
2019 }
2020 toolUsage, err := db.InsertAIBridgeToolUsage(genCtx, database.InsertAIBridgeToolUsageParams{
2021 ID: takeFirst(seed.ID, uuid.New()),
2022 InterceptionID: takeFirst(seed.InterceptionID, uuid.New()),
2023 ProviderResponseID: takeFirst(seed.ProviderResponseID, "provider_response_id"),
2024 ProviderToolCallID: takeFirst(seed.ProviderToolCallID),
2025 Tool: takeFirst(seed.Tool, "tool"),
2026 ServerUrl: serverURL,
2027 Input: takeFirst(seed.Input, "input"),
2028 Injected: takeFirst(seed.Injected, false),
2029 InvocationError: invocationError,
2030 Metadata: takeFirstSlice(seed.Metadata, json.RawMessage("{}")),
2031 CreatedAt: takeFirst(seed.CreatedAt, dbtime.Now()),
2032 })
2033 require.NoError(t, err, "insert aibridge tool usage")
2034 return toolUsage
2035}
2036
2037func AIBridgeModelThought(t testing.TB, db database.Store, seed database.InsertAIBridgeModelThoughtParams) database.AIBridgeModelThought {
2038 thought, err := db.InsertAIBridgeModelThought(genCtx, database.InsertAIBridgeModelThoughtParams{

Callers 4

TestTelemetryFunction · 0.92

Calls 5

NowFunction · 0.92
takeFirstSliceFunction · 0.85
takeFirstFunction · 0.70
NewMethod · 0.65

Tested by 4

TestTelemetryFunction · 0.74