#π I'm just looking to get this setup
1 messages Β· Page 1 of 1 (latest)
Hi! It's probably not user error.. I just pushed a change to how we handle LLM endpoint configuration, and probably broke something... sorry!
- Can you confirm that the
.envis in the current directory? At the moment it doesn't work if the.envis in a parent dir (even though it should)
Also: try setting these as actual env variables, rather than .env, and see if it resolves the issue?
will do - do you have any advise on the format for the BASE_URL env var?
it's passed directly to the official openai API client (their go sdk specifically) so whatever their official tools support
cc @kind oriole
π€ is there a way to trigger a one off call to the LLM?
β― ~/bin/dagger-llm shell -c "llm | with-prompt 'hello' | history "
β connect 0.1s
β looking for module 0.2s
β loading type definitions 0.2s
β llm: Llm! 0.0s
β .withPrompt(prompt: "hello"): Llm! 0.0s
βπ§ hello
β .history: [String!]! 0.0s
π§ π¬hello
yes, I made it excessively lazy, you have to explicitly call loop in between
β― ~/bin/dagger-llm shell -c "llm | with-prompt 'hello' | loop | history "
β connect 0.1s
β looking for module 0.2s
β loading type definitions 0.2s
β llm: Llm! 0.0s
β .withPrompt(prompt: "hello"): Llm! 0.0s
βπ§ hello
β .loop: Llm! 1.4s
I can't see the call to the LLM, or an error out
thought it looked cool, because you can see where the "agentic loop" takes place. But adds unnecessary verbosity so I will change it back
@ivory moss I think this might be "shell doesn't print errors"
@nimble fable can you try running dagger shell then running the same dagger pipeline but interactively?
ok - there is this in the trace now with the env var set
so that's picked up the correct vars, I think
ok - more of an error this time
β― ~/bin/dagger-llm shell [15:30:22]
Dagger interactive shell. Type ".help" for more information. Press Ctrl+D to exit.
β llm | model 0.0s
llama-3-70b(other)
β llm | with-prompt "can you say hello world back to me" | loop | history 1.3s
! input: llm.withPrompt.loop panic while resolving Llm.loop: runtime error: invalid memory address or nil pointer dereference
looking at https://github.com/shykes/dagger/commit/29d157845ab902d41e0edd42ff04aa77291a3eee
is it becuase I'm using an OpenAI compatiable endpoint, but with a llama model?
Maybe the API key isn't being picked up & sent in the request
#guess
this code
func (r *LlmRouter) isOpenAIModel(model string) bool {
return strings.HasPrefix(model, "gpt-") || strings.HasPrefix(model, "openai/")
}
func (r *LlmRouter) isLlamaModel(model string) bool {
return strings.HasPrefix(model, "llama-") || strings.HasPrefix(model, "meta/")
}
my env of Model = "llama-3-70b" will fall out to
func (r *LlmRouter) routeOtherModel() *LlmEndpoint {
return &LlmEndpoint{
BaseURL: r.OPENAI_BASE_URL,
Provider: Other,
}
}
which now doesn't send the API key
βΈ staging (civo-system) in melvin on ξ main [!] on βοΈ dinesh@civo.com
β― env | grep OPENAI | grep -v KEY
OPENAI_BASE_URL=https://api.relax.ai
OPENAI_MODEL=openai/llama-3-70b
βΈ staging (civo-system) in melvin on ξ main [!] on βοΈ dinesh@civo.com
β― ~/bin/dagger-llm shell
Dagger interactive shell. Type ".help" for more information. Press Ctrl+D to exit.
β llm | model 0.0s
llama-3-70b(other)
I would expect the llm | model to output
lama-3-70b (openai)
yes that's the very new code (12 hours old) and clearly it's broken... will try to fix now
ah that's it, I didn't think I would need to send the API key. silly in retrospect
but that shouldn't cause a panic so there's probably something else
can you see the stack trace anywhere?
noted - maybe has to do with -c, will check soon
I noticed with the former code that I would get a "couldn't find .env file" error some percentage of the time, even though it was there, when running dagger shell and connecting to the llm dev engine.
that would previously come from not running llm before another pipeline using llm
ah, right, forgot that was a requirement with that setup. I'd been doing it unconciously but inconsistently
reminder guys we're in a support thread π
Your error looks very familiar to me. I think I was getting that previously. Happy to jump on with you to troubleshoot in discord.
it's probably something silly that I introduced last night
@fierce sail - I can hop on a call within the next hour
I'm pushing a first fix, to send the API key on your endpoint. That shouldn't be the cause for the panic, but it's needed either way
pushed
If you pull the latest version of melvin, and re-run dagger shell -c './dagger-llm | engine | up' (or re-run ./setup.sh) the fix should be applied
@boreal pecan the v1 is getting stripped off the baseURL somehow when chat/completions is appended
its working for me. I can try to help. Note if you change the OPENAI_BASE_URL (or any .env var) you have to restart the engine
Now the client deletes the base url path. For example, if you use https://some-comparable-api.local/v1 as the base url, requests will be sent without /v1
Going to add the trailing slash, restart engine, and try it
restarted the engine, and this is now sending requests
A new shell only did not work
requests are now being sent to the LLM, I still get this error
Anything else we could collect for diagnosis @kind oriole besides π
This is on relax? Which model?
If he drops loop the errors go away, but doesn't call the LLM
@kind oriole we can figure it out and follow up.
the index out of range is from here https://github.com/shykes/dagger/blob/llm/core/llm.go#L582 just not sure why yet
Maybe because it's streaming? Not sure
fwiw I'm running vanilla ollama and not seeing this error
They use this via tools for their web search, so they haven't seen this issue.
sorry not sure what that means
Working on fixing that right now, with the help of @sturdy python and @smoky valley π
I was just asking if their model was verified as fully openai tools compatible and they use it via that interface in prod, so yes!
@nimble fable can you let me know when you have a chance to try again? I'm curious if my fix helps
checking now
@boreal pecan, I can't see a recent change. The last one I have is
- 23cf032 (HEAD -> main, origin/main, origin/HEAD) update dagger dependency
this now get's a response from the LLM correctly (so passes the key in the request) but it still shows the stacktrace above
that's the one
Oh sorry I missed that update
I feel like I'm missing something obvious... Do you spot anything @kind oriole @ivory moss in that stack trace?
It seems related to streaming
Maybe it crashes if an endpoint doesn't support streaming, or handles it in a non-standard way?
This is in the stack trace:
acc := new(openai.ChatCompletionAccumulator)
for stream.Next() {
if stream.Err() != nil {
return nil, stream.Err()
}
res := stream.Current()
acc.AddChunk(res)
// π
if content := res.Choices[0].Delta.Content; content != "" {
// π
if logsW == nil {
// only show a message if we actually get a text response back
// (as opposed to tool calls)
ctx, span := Tracer(ctx).Start(ctx, "LLM response", telemetry.Reveal(), trace.WithAttributes(
attribute.String("dagger.io/ui.actor", "π€"),
attribute.String("dagger.io/ui.message", "received"),
))
defer telemetry.End(span, func() error { return rerr })
stdio := telemetry.SpanStdio(ctx, "",
log.String("dagger.io/content.type", "text/markdown"))
logsW = stdio.Stdout
}
fmt.Fprint(logsW, content)
}
}
that's my guess yeah
Yeah can you check res.Choices first before [0]?
it's kind of weird, i'd expect stream.Err() != nil in that case
@kind oriole @ivory moss can I let you handle this one? I'm close to a fix for "bug 7" (clean llm config without having to re-run llm after setup & each engine restart)
I don't have a repro. @fierce sail were you able to repro with the relax key?
just finished a meeting and spinning up repro now with latest llm branch
Got the repro, thanks @fierce sail , working on a fix
Pushed a fix. My repro is working now!