logoalt Hacker News

jasondigitized • today at 2:44 PM • 3 replies • view on HN

Any tips on how to get started?


Replies

japhyr • today at 2:59 PM

I'm most familiar with Python, so I built a Textual app using an OpenAI API plan.

There's just two boxes to start with: an input message box for prompting, and a conversation box. Dump each input message into the conversation box. Post the response to the conversation box.

Once you get a prompt-and-response cycle going, you can start to define tools. A tool is a description of an action the model can request to carry out, and you write a function to implement that tool call. The tool descriptions get sent with each API call, and then the model can start calling tools as part of its response.

I added a box to clearly show the project directory, and a couple boxes to show which tools were being called and whether the model was attempting to cross any boundaries it shouldn't. A fun milestone is when you get to use the harness you're building to help build itself.

I didn't want to over abstract the implementation, but it's reasonably well structured. The TUI is separate from the tool definitions. The tool definitions are model-agnostic. Everything specific to OpenAI is in an openai_model.py file. If I want to use Anthropic models, I could add an anthropic_model.py file. Or I could make it all local and add a local_model.py file.

I'm not working with subagents yet, but I can see a way to implement that if I end up wanting to.

The OpenAI Python library makes these interactions really straightforward to implement:

https://github.com/openai/openai-python

sceptic123 • today at 3:04 PM

Maybe read the linked article?

stronglikedan • today at 2:49 PM

Claude, build me a harness.