Llama2App.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import logging
  2. from typing import Optional
  3. from embedchain.apps.app import App
  4. from embedchain.config import CustomAppConfig
  5. from embedchain.helper.json_serializable import register_deserializable
  6. from embedchain.llm.llama2 import Llama2Llm
  7. @register_deserializable
  8. class Llama2App(App):
  9. """
  10. The EmbedChain Llama2App class.
  11. Methods:
  12. add(source, data_type): adds the data from the given URL to the vector db.
  13. query(query): finds answer to the given query using vector database and LLM.
  14. chat(query): finds answer to the given query using vector database and LLM, with conversation history.
  15. .. deprecated:: 0.0.64
  16. Use `App` instead.
  17. """
  18. def __init__(self, config: CustomAppConfig = None, system_prompt: Optional[str] = None):
  19. """
  20. .. deprecated:: 0.0.64
  21. Use `App` instead.
  22. :param config: CustomAppConfig instance to load as configuration. Optional.
  23. :param system_prompt: System prompt string. Optional.
  24. """
  25. logging.warning(
  26. "DEPRECATION WARNING: Please use `App` instead of `Llama2App`. "
  27. "`Llama2App` will be removed in a future release. "
  28. "Please refer to https://docs.embedchain.ai/advanced/app_types#llama2app for instructions."
  29. )
  30. super().__init__(config=config, llm=Llama2Llm(), system_prompt=system_prompt)