Add caching for langchain types dictionary
This commit is contained in:
parent
19f998a326
commit
4e5ec2a4de
1 changed files with 2 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import warnings
|
||||||
from typing import Any, List, Optional, Union
|
from typing import Any, List, Optional, Union
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
|
from cachetools import LRUCache, cached
|
||||||
from fastapi import HTTPException
|
from fastapi import HTTPException
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
|
|
@ -49,6 +50,7 @@ def get_type_list():
|
||||||
return all_types
|
return all_types
|
||||||
|
|
||||||
|
|
||||||
|
@cached(LRUCache(maxsize=1))
|
||||||
def build_langchain_types_dict(): # sourcery skip: dict-assign-update-to-union
|
def build_langchain_types_dict(): # sourcery skip: dict-assign-update-to-union
|
||||||
"""Build a dictionary of all langchain types"""
|
"""Build a dictionary of all langchain types"""
|
||||||
all_types = {}
|
all_types = {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue