#llm | with_container ??

1 messages · Page 1 of 1 (latest)

molten crow
#

Hey all, sorry for all the beginner questions. Still trying to wrap my brain around the dagger system. Day 2 so bear with me 🙂


Was trying to follow along with @mild lily 's talk here: https://www.youtube.com/watch?v=1HA9h1MnUy0

He runs the command:

llm | with-container $(container | from alpine |
with-new-file yay.txt 'my favorite language is php') | with-prompt "you have access to a container. read the file at path yay.txt !!!! it mentions a programming language. install on the container what is needed to develop in that language" | history

However, I'm not seeing the with-container function available when I try to chain from the llm. He mentioned that his demo was using a dev version, but that was 3 months ago.

✔ version 0.0s
v0.18.9

I've been trying to translate that command to what's in the docs here:

base=$(container | from alpine)
env=$(env | with-container-input 'base' $base 'a base container' | with-container-output 'python-dev' 'a container with python dev tools')
llm | with-env $env | with-prompt "You have an alpine container. Install tools to develop with Python." | env | output python-dev | as-container | terminal

https://docs.dagger.io/features/llm

Thanks to Sourcegraph for hosting AI DevTools Meetup! Watch the recording to see the following demos:

  • Pushing the boundary of what's possible with code AI by YK Sugi, Senior Developer Advocate @ Sourcegraph
  • Preswald: Build data apps in Python by Amrutha Gujjar @ CEO & Co-Founder, Structured
  • Agent Contracts: a new approach to building t...
▶ Play video

Build powerful AI agents with Large Language Models

#

I was able to get the following to work:

llm | with-env $(env | with-container-input 'base' $(container | from alpine | with-new-file yay.txt 'my favorite language is php') 'a base container' | with-string-output 'language' 'the programming language') | with-prompt "You have access to a container. Read the file at path yay.txt. It mentions a programming language, what is it?" | env | output language

This seems far more verbose and less ergonomic than Solomons demo. Is this correct?

floral void
#

@mild lily 👆

Indeed we have Environment (env) support now, it works really well in code. Annotated multiple objects for inputs/outputs is one big benefit. There are some ideas for offering a less verbose option.

Since you're in Dagger Shell, you could also shortcut by taking advantage of the "default env" that exists when you switch to prompt mode, like this:

⋈ ctr=$(container | from alpine | with-new-file yay.txt 'my favorite language is php')

gpt-4.1 ❯ You have access to a container. Read the file at path yay.txt. It mentions a programming language, what is it?
...
🤖 The programming language mentioned in yay.txt is PHP.
mild lily
# molten crow I was able to get the following to work: ``` llm | with-env $(env | with-contai...

Yes, the version in my demo only supported one object at a time in the llm context; we wanted to add the ability for the llm to access multiple objects for composition. We had some trouble getting it to work and ended up making last minute API changes to ship it. In the process we made the quickstart less ergonomic as you noted. We're working on making it simpler and more polished again.