Skip to content
This repository was archived by the owner on Nov 27, 2025. It is now read-only.

Conversation

@rileytomasek
Copy link
Collaborator

@rileytomasek rileytomasek commented Jun 14, 2023

This continues from #26

Adds support for function calling:

Todo:

  • Test/add streaming support

transitive-bullshit and others added 5 commits June 13, 2023 18:06
Stricter support for narrowing/inference by using a union of the many
  variants of ChatMessage.
Using [`passthrough()`](https://zod.dev/?id=passthrough) will allow users to pass params that we haven't added to the Zod
params schemas. Zod strips unknown keys from objects without this.

Thanks: #26 (comment)
These will likely be helpful when working with the ChatMessage data
before making the request.
@transitive-bullshit
Copy link
Contributor

@rileytomasek What would you think about merging and releasing as-is via a minor version bump?

I know it's technically a breaking change, so we'd ideally want to combine this with the streaming support, but I think it's more important to get it released.

@rileytomasek
Copy link
Collaborator Author

@rileytomasek What would you think about merging and releasing as-is via a minor version bump?

I know it's technically a breaking change, so we'd ideally want to combine this with the streaming support, but I think it's more important to get it released.

I'm fine with that. I think it would only be a breaking change at the types level, if at all.

@transitive-bullshit
Copy link
Contributor

LGTM 👍

@rileytomasek rileytomasek merged commit 0fb9af5 into master Jun 15, 2023
@rileytomasek rileytomasek deleted the transitive-bullshit/master branch June 15, 2023 03:19
@rileytomasek
Copy link
Collaborator Author

rileytomasek commented Jun 15, 2023

Released as v1.6.0

@transitive-bullshit
Copy link
Contributor

I'm getting some undesired type errors after the latest updates:

CleanShot 2023-06-14 at 22 17 28@2x
// this gives a type error
if (completion.message.function_call) { ... }
// this works fine
if (completion.message.role === 'assistant' && completion.message.completion.message.function_call) { ... }

@rileytomasek I think both of these should work type-wise.


Another unrelated error where I'm less sure what's going on is that it seems like using an array of messages and appending a message result from a previous chat completion call results in a TS error when trying to pass that new messages array.

CleanShot 2023-06-14 at 22 20 09@2x CleanShot 2023-06-14 at 22 22 44@2x

rileytomasek added a commit that referenced this pull request Jun 17, 2023
This makes the various ChatMessage types slightly less strict, which
should make them easier to work with, but still not allow for strictly
incorrect usage.

Should fix: #27 (comment)
rileytomasek added a commit that referenced this pull request Jun 17, 2023
This makes the various ChatMessage types slightly less strict, which
should make them easier to work with, but still not allow for strictly
incorrect usage.

Should fix: #27 (comment)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants