Skip to content

Best practices for extending ChatWrapper while reusing LlamaChatSession #429

Closed Answered by giladgd
snowyu asked this question in Q&A
Discussion options

You must be logged in to vote

Most of your questions would be answered by this documentation: https://node-llama-cpp.withcat.ai/guide/external-chat-state

Need to maintain OpenAI-style message format (AIChatMessageParam[])

You can create an adaptation yourself from ChatHistoryItem[] to the OpenAI format and vice verse.
Note that the ChatHistoryItem type contains more information than the OpenAI format, so doing that will mean you'll miss out on some features, but mostly things that you can only do with node-llama-cpp and not with an OpenAI API, so this may be fine for your use case.
The main features pertain to content segmentation and the stability of the context state to reuse it as much as possible and avoid redun…

Replies: 5 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by giladgd
Comment options

You must be logged in to vote
1 reply
@giladgd
Comment options

Comment options

You must be logged in to vote
1 reply
@giladgd
Comment options

Comment options

You must be logged in to vote
1 reply
@giladgd
Comment options

Comment options

You must be logged in to vote
0 replies
# for free to join this conversation on GitHub. Already have an account? # to comment
Category
Q&A
Labels
None yet
2 participants