Hacker News new | ask | show | jobs
by ilaksh 997 days ago
Nice. Just to point out, calling a sequence of functions is what GPT-4 does automatically if you keep feeding it the responses and it is clear to it that is necessary given it's instructions.

So the main point of this seems to be extracting the interface from the module and converting it into the OpenAI API call's functions format.

It's a good idea. But for me I would rather just have an npm package with a function like

  extractFunctions(srcFilename)
which I could then use inside of my own project which already handles the rest of it.
3 comments

Thank you! You're right; the main focus right now is extraction.

One aspect I'm excited about is the possibility of rendering the JSON outputs from these function calls into UI components, as previewed here: https://symphony.run/showcase. Using a function's type definitions is a nice starting point to embed interfaces into the conversation.

Additionally, I hope to make the toolkit language-agnostic. I'd like to incorporate some of my .py and .rs scripts to make them ready for use as well. Not sure if packaging it as an npm package would go against that objective, but will definitely consider :)

Well, this knows when to stop calling GPT-4, which seems non-trivial.
ChatGPT does this automatically, if you pass in `function_call: "auto"`
How would this work? Say I need multiple function calls to handle a user prompt. OpenAI will only supply one function call at a time. My understanding is that "auto" just lets it choose which function to call, but you still have to know that you need to call it multiple times, and when to stop.
It can make multiple function calls. For example I have it hooked up to edit word documents, and I can say "create a word document, add a paragraph describing yourself and then add title 'xyz'" and it will make three separate function calls to do this before responding saying that it's completed the task.
Yep. I built this for Python recently and it uses introspection to automatically build this same info. It's maybe 100 lines in total? The OpenAI API is pretty amazing.
That sounds great! I'm currently working on adding support for .py files as well – open to PRs :)
Have you packaged or shared your codebase? If so would love to see it!