Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for new OpenAI release post dev day #7

Merged
merged 16 commits into from
Nov 9, 2023

Conversation

transitive-bullshit
Copy link
Collaborator

@transitive-bullshit transitive-bullshit commented Nov 7, 2023

  • adds support for tools
  • changes some other types required by openai updates

Copy link

vercel bot commented Nov 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dexter ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 9, 2023 2:23am

Copy link
Contributor

@rileytomasek rileytomasek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the best way to think about the relationship between the legacy functions and the new tools.

It seems like the legacy functions have the same structure and function, but are now nested under tools. I think all of the schema/spec/parser/implementation parts of AIFunction should stay the same (without tools) and should be used by a new higher level tools abstraction that is just wraps a function for now, and presumably other things in the future.

Also, can you please start writing real commit messages :)

src/prompt/utils/message.ts Show resolved Hide resolved
@transitive-bullshit
Copy link
Collaborator Author

It seems like the legacy functions have the same structure and function, but are now nested under tools. I think all of the schema/spec/parser/implementation parts of AIFunction should stay the same (without tools) and should be used by a new higher level tools abstraction that is just wraps a function for now, and presumably other things in the future.

Sounds good & agreed. I haven't actually used createAIFunction yet, so that would be a good first step haha

Also, can you please start writing real commit messages :)

Yep; sorry about that. I try to use real git-flow commit messages for substantive stuff and commit-emoji for minor things. Will work on breaking that habit for dexa stuff. :)

@transitive-bullshit
Copy link
Collaborator Author

This PR is now dependent on dexaai/openai-fetch#38

@transitive-bullshit
Copy link
Collaborator Author

transitive-bullshit commented Nov 8, 2023

@rileytomasek I changed the tools and function assistant types and utility functions to have an explicit assistant prefix.

I also fixed all the lingering TS issues, mainly due to the message stuff. Such a PITA.

Not 100% sure I incorporated the assistant prefix feedback you gave as you were expecting. Happy to adjust.

@transitive-bullshit transitive-bullshit changed the title WIP Updates for new OpenAI release post dev day Updates for new OpenAI release post dev day Nov 8, 2023
Copy link
Contributor

@rileytomasek rileytomasek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good other than the name changes. Can we hold off removing the Message.name stuff until everything settles from the new releases and it's clear what the status of name is? We're using it internally and I'd rather not change until we know it's definitely gone.

Edit: these changes are also going to require a major version bump, right?

choices: [
{
finish_reason:
choice.finish_reason as Model.Chat.Response['choices'][0]['finish_reason'],
index: choice.index,
message: choice.delta as Model.Message,
message: choice.delta as Model.Message & { role: 'assistant' },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this now that you fixed the types for openai-fetch?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question && yes, unfortunately TS complains without it.

One thing I've noticed is that the new openai types seem to have gotten a lot stricter in terms of inputs/outputs used in different places. I could be wrong since I've only just started getting back into things.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CleanShot 2023-11-08 at 14 45 45@2x

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is just from their jank types so we can leave as is for now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? We are using this internally and I'd rather not change the existing code unless there is a reason for this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm was just a part of my removing name, and I thought it made more sense to have a util to format the name identifier directly than an object which at the time I was thinking would no longer have a name property.

all good && will revert

@transitive-bullshit
Copy link
Collaborator Author

This looks good other than the name changes. Can we hold off removing the Message.name stuff until everything settles from the new releases and it's clear what the status of name is? We're using it internally and I'd rather not change until we know it's definitely gone.

Done.

Edit: these changes are also going to require a major version bump, right?

Yes, though it's a brand new package, so we could just do a minor? I'm fine either way.

@transitive-bullshit
Copy link
Collaborator Author

Fixes #8 as well

/** Message with text content for the system. */
export type System = {
role: 'system';
name?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed these names when reverting

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhh good catch :) will revert

@rileytomasek
Copy link
Contributor

rileytomasek commented Nov 9, 2023

Everything looks good, except for the names I suggested 😂

What do you think of:

System
User
Assistant
FuncCall
FuncResult
ToolCall
ToolResult

And then mirror to Msg methods like:

Msg.system()
Msg.user()
Msg.assistant()
Msg.funcCall()
Msg.funcResult()
Msg.toolCall()
Msg.toolResult()

Msg.isSystem()
Msg.isUser()
Msg.isAssistant()
Msg.isFuncCall()
Msg.isFuncResult()
Msg.isToolCall()
Msg.isToolResult()

@transitive-bullshit
Copy link
Collaborator Author

Everything looks good, except for the names I suggested 😂

What do you think of:

System
User
Assistant
FuncCall
FuncResult
ToolCall
ToolResult

And then mirror to Msg methods like:

Msg.system()
Msg.user()
Msg.assistant()
Msg.funcCall()
Msg.funcResult()
Msg.toolCall()
Msg.toolResult()

Msg.isSystem()
Msg.isUser()
Msg.isAssistant()
Msg.isFuncCall()
Msg.isFuncResult()
Msg.isToolCall()
Msg.isToolResult()

I'm not opinionated when it comes to naming; the only problem I see w/ this is that ToolCall type represents both the individual tool call { id: string, type: string, function: FunctionCall } as well as the tool call message type, which represents an array of tool calls.

It's the same issue w/ FunctionCall type except you got around that by shortening the message function call type to FuncCall to avoid the naming collision.

I don't have a strong feeling either way.

@transitive-bullshit
Copy link
Collaborator Author

If we call the tool calls message ToolCalls or ToolsCall, that would get around it. ToolsCall sounds better, but it's weird for the underlying field to be tool_calls and then refer to it as a ToolsCall...

Copy link
Contributor

@rileytomasek rileytomasek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@transitive-bullshit transitive-bullshit merged commit adea736 into master Nov 9, 2023
8 checks passed
@transitive-bullshit transitive-bullshit deleted the feature/dev-day-updates branch November 9, 2023 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants