Skip to content

Commit

Permalink
Added support for pydantic v2 (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
whitead authored Sep 7, 2023
1 parent c11a9f9 commit 0598fa7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion paperqa/contrib/zotero.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
from pathlib import Path
from typing import List, Optional, Union, cast

from pydantic import BaseModel
try:
from pydantic.v1 import BaseModel
except ImportError:
from pydantic import BaseModel

try:
from pyzotero import zotero
Expand Down
6 changes: 5 additions & 1 deletion paperqa/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
from langchain.memory import ConversationTokenBufferMemory
from langchain.memory.chat_memory import BaseChatMemory
from langchain.vectorstores import FAISS, VectorStore
from pydantic import BaseModel, validator

try:
from pydantic.v1 import BaseModel, validator
except ImportError:
from pydantic import BaseModel, validator

from .chains import get_score, make_chain
from .paths import PAPERQA_DIR
Expand Down
7 changes: 6 additions & 1 deletion paperqa/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
CallbackManagerForChainRun,
)
from langchain.prompts import PromptTemplate
from pydantic import BaseModel, validator

try:
from pydantic.v1 import BaseModel, validator
except ImportError:
from pydantic import BaseModel, validator


from .prompts import (
citation_prompt,
Expand Down
2 changes: 1 addition & 1 deletion paperqa/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.9.1"
__version__ = "3.10.0"

0 comments on commit 0598fa7

Please sign in to comment.