Replies: 1 comment 1 reply
-
#22589 Hope help you 👍 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked
Feature request
Hello everyone!
Recently noticed that the class
langchain_community.llms.llamacpp.LlamaCpp
uses only_call
or_stream
functions to communicate with originalllama_cpp.llama.Llama
class.Inside of
_call
function it makes forward calling ofllama_cpp.llama.Llama
Example:
result = self.client(prompt=prompt, **params)
where client isllama_cpp.llama.Llama
objectSuch relization blocks opportunity to use chat models with given
ChatPromptValue
as input. TheChatPromptTemplate
simply turns into string and passes to_call
.Probably it worth adding handling of
llama_cpp.llama.Llama.create_chat_completion
method to create support for the Chat modelsMotivation
LlamaCpp
cover forllama_cpp.llama.Llama
currently can't properly handle Chat messagesProposal (If applicable)
The parent
BaseLLM
class ofLlamaCpp
makes
invoke
call thread:LLMChain.invoke -> BaseLLM.invoke -> BaseLLM.generate_prompt -> BaseLLM.generate_prompt -> BaseLLM._generate_helper -> LLM._generate -> LlamaCpp._call -> llama_cpp.llama.Llama.__call__
I have noticed that in
BaseLLM.generate_prompt
every prompt just turns into string. And that is common for every single model. So every model looses its opportunity to parse sequence of messages by its own (many models on huggingface have their Chat template parsing)I suppose. It is more global problem than it seemed. It will be very usefull to leave ability of LLMs to parse chat models by their own and not parse messages inside of LangChain into string
Beta Was this translation helpful? Give feedback.
All reactions