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

Add ChatMessage as a first class cog type #2186

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

8W9aG
Copy link
Contributor

@8W9aG 8W9aG commented Mar 6, 2025

8W9aG added 2 commits March 6, 2025 13:43
* Add typed dictionaries which conform to OpenAI’s
protocol specification as first class objects due
to the ubiquity of their use.
@8W9aG 8W9aG requested review from fofr and andreasjansson March 6, 2025 18:47
@andreasjansson
Copy link
Member

Niceee!

Is there a reason to use CommonChatSchemaChatMessage instead of just calling it ChatMessage?

How do you test this with cog predict? Does cog predict -i messages='[{"role": "user", "content": "hello"}]' work?

@8W9aG
Copy link
Contributor Author

8W9aG commented Mar 7, 2025

Niceee!

Is there a reason to use CommonChatSchemaChatMessage instead of just calling it ChatMessage?

How do you test this with cog predict? Does cog predict -i messages='[{"role": "user", "content": "hello"}]' work?

Reason for the namespace CommonChatSchema was to namespace all the sub objects such as Audio and Function, however I can change the root to ChatMessage if it suits since its a union anyway.

I couldn't get cog predict to work on this but I can get it to recognise an API call, would you like me to extend the support to cog predict?

@andreasjansson
Copy link
Member

Yes I think ChatMessage is cleaner. And it would be great if we could get it working with cog predict so these functions can be tested locally.

8W9aG added 4 commits March 7, 2025 15:28
* Use the schema to parse the expected format of
the key, and if it is in our anticipated formats
encode it with JSON and send that via API to the
cog service.
* This is valid in OpenAPI
@8W9aG
Copy link
Contributor Author

8W9aG commented Mar 10, 2025

Yes I think ChatMessage is cleaner. And it would be great if we could get it working with cog predict so these functions can be tested locally.

I believe this now complete

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.

3 participants