diff --git a/libs/community/langchain_community/llms/deepsparse.py b/libs/community/langchain_community/llms/deepsparse.py index 1d8166e687cef..ab7a7c58b4ea5 100644 --- a/libs/community/langchain_community/llms/deepsparse.py +++ b/libs/community/langchain_community/llms/deepsparse.py @@ -63,7 +63,7 @@ def validate_environment(cls, values: Dict) -> Dict: except ImportError: raise ImportError( "Could not import `deepsparse` package. " - "Please install it with `pip install deepsparse`" + "Please install it with `pip install deepsparse[llm]`" ) model_config = values["model_config"] or {} @@ -103,9 +103,7 @@ def _call( text = combined_output else: text = ( - self.pipeline( - sequences=prompt, generation_config=self.generation_config - ) + self.pipeline(sequences=prompt, **self.generation_config) .generations[0] .text ) @@ -143,9 +141,7 @@ async def _acall( text = combined_output else: text = ( - self.pipeline( - sequences=prompt, generation_config=self.generation_config - ) + self.pipeline(sequences=prompt, **self.generation_config) .generations[0] .text ) @@ -184,7 +180,7 @@ def _stream( print(chunk, end='', flush=True) """ inference = self.pipeline( - sequences=prompt, generation_config=self.generation_config, streaming=True + sequences=prompt, streaming=True, **self.generation_config ) for token in inference: chunk = GenerationChunk(text=token.generations[0].text) @@ -222,7 +218,7 @@ async def _astream( print(chunk, end='', flush=True) """ inference = self.pipeline( - sequences=prompt, generation_config=self.generation_config, streaming=True + sequences=prompt, streaming=True, **self.generation_config ) for token in inference: chunk = GenerationChunk(text=token.generations[0].text)