Welcome to Portkey Forum

Updated 2 months ago

A Standardized Message Format for Portkey

At a glance

The community member is looking for a way to get a message object from Portkey without having to use the Langchain package. The comments indicate that Portkey does not provide a standardized message format, and the community members explain that this is a conscious decision to follow the OpenAI schema rather than creating their own abstraction. The community members suggest that the user would need to parse the JSON data and read the role key to determine the conversation role.

Hey guys πŸ™‚ Is there any imports to get a message object from portkey? Langchain has AIMessage, HumanMessage etc and id prefer not to download the langchain package so I was wondering if you guys use some standardized message format without resorting to json
s
V
M
7 comments
Nope, you'd have to parse the JSON and read the role key to determine the conversation role
This is a conscious choice by us @MolBioBoy - curious if it's something you can't live without
@Vrushank | Portkey not something I can't live without necessarily, I just have to convert and revert in my llm class, but it makes sense for me to use it as it declutters my code

since portkey is a unified platform for LLMs it seems logical to me that the key data structures are also unified. I dont think it should give you an error if you try to invoke with a list of langchain messages for example.

How come the decision was to keep it that way? Does it simplify the api call?
Hmm that's interesting - we extend interoperability just beyond the API to other frameworks like Langchain too
Because we are explicitly following the OpenAI schema, we think that we should not be in a position to recommend an abstraction of our own
that makes sense. I guess if you did that you'd end up having the same issues langchain does
Add a reply
Sign up and join the conversation on Discord