https://www.boundaryml.com logo
Also got an exciting panic, will thread
# questions
t
Also got an exciting panic, will thread
Sooooo, I am definitely fuckin stuff up (calling a collector before its ready)
but the panic is also meh
v
panic is def not good here
it should give a acutall go err
will track this down
t
👍
definitely my bug
but agree
b
@Vaibhav (BAML 🐑) were you able to reproduce this one?
@tberman can you give us a pseudo code of what you're trying to do here, so that we can repro this at our end? Thanks!
t
yah, just call a streaming call with a collector and then immediately call collector.Usage()
you will get a panic not an err
its bad behavior, but i should get an err not a panic
v
hmm, its odd. been trying to repro this for a bit:
Copy code
go
func TestCollectorBeforeStreaming(t *testing.T) {
    ctx := context.Background()
    
    collector, err := b.NewCollector("my-collector")
    require.NoError(t, err)
    
    // Make streaming call with collector
    stream, err := b.Stream.TestOpenAIGPT4oMini(ctx, "elaborate on the following: 'The quick brown fox jumps over the lazy dog.'", b.WithCollector(collector))
    require.NoError(t, err)

    // Check logs
    usage, err := collector.Usage()
    require.NoError(t, err)
    inputTokens, err := usage.InputTokens()
    require.NoError(t, err)
    assert.Equal(t, int64(0), inputTokens)
    outputTokens, err := usage.OutputTokens()
    require.NoError(t, err)
    assert.Equal(t, int64(0), outputTokens)
    fmt.Println("inputTokens", inputTokens)
    fmt.Println("outputTokens", outputTokens)
    
    var finalResult string
    for value := range stream {
        if value.IsFinal && value.Final() != nil {
            finalResult = *value.Final()
        }
    }
    
    assert.NotEmpty(t, finalResult)
    
    logs, err := collector.Logs()
    require.NoError(t, err)
    assert.Len(t, logs, 1)
any clues about what i might be missing. I can confirm I'm seeing a 0 before the BAML_LOG prints so its def triggering...
t
only possible difference i can see is my collector had an empty string for a name?
also using claude which maybe makes some difference?
v
tried with claude and can't repro. do you get a consistent repro? if so, could you run with:
Copy code
RUST_BACKTRACE=1 cmd to run
empty string doesn't repro either 🙁
t
i fixed it by not calling right away
but when im not doing other stuff i can check it out!
v
yea ofc! i'll keep trying to get a repro as well