Skip to content

Commit

Permalink
[joonspk-research#93] Re-enable caching (using built-in LangChain cac…
Browse files Browse the repository at this point in the history
…hing)
  • Loading branch information
septagram committed Mar 28, 2024
1 parent ece6c03 commit 37a9fb7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ static_dirs/*
/environment/frontend_server/storage
/environment/frontend_server/temp_storage
/reverie/backend_server/debug_cache.json
/reverie/backend_server/.langchain.db

!storage/base_the_ville_isabella_maria_klaus/*
!storage/base_the_ville_n25/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import re
import traceback

Expand All @@ -17,12 +18,19 @@
from langchain_core.example_selectors.base import BaseExampleSelector
from langchain_core.exceptions import OutputParserException
from langchain_community.vectorstores import Chroma
from langchain.globals import set_llm_cache
from langchain.cache import SQLiteCache

import utils as config
from persona.prompt_template.SimplifiedPedanticOutputParser import SimplifiedPydanticOutputParser, JSONType, find_and_parse_json
from persona.prompt_template.embedding import LocalEmbeddings
from persona.common import deindent

if config.debug_cache_clear and os.path.exists(".langchain.db"):
os.remove(".langchain.db")
if config.debug_cache_enabled:
set_llm_cache(SQLiteCache(database_path=".langchain.db"))

def ColorEcho(color: Optional[Color] = None, template: str = "{value}", full_prompt: bool = False):
def invokeColorEcho(value: Union[ChatPromptValue, BaseMessage, str]):
displayValue = value
Expand Down

0 comments on commit 37a9fb7

Please sign in to comment.