cog
cog copied to clipboard
Support OpenAI-compatible ChatMessage type
For language models, it'd be good to support an input type that's consistent with the OpenAI API.
I imagine something like this:
from cog import Input
from cog.types import ChatMessage
def run(
messages: list[ChatMessage] = Input(),
) -> str:
print(messages)
return f"HELLO {messages[0]['role']}"
Progress: https://github.com/replicate/cog/pull/2261
Implementation in cog-runtime: https://github.com/replicate/cog-runtime/pull/71