Skip to content

Commit 3bc82ba

Browse files
authored
Merge pull request #30 from andri-jpg/main
use pydantic.v1 in langchain.py
2 parents e6fcfb0 + d6cf42e commit 3bc82ba

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

llm_rs/langchain/langchain.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
from typing import Any, Dict, Optional, Sequence, Union, List
1010
import os
1111

12-
from pydantic import root_validator
12+
try:
13+
from pydantic.v1 import root_validator
14+
except ImportError:
15+
from pydantic import root_validator
1316

1417
from ..auto import AutoModel, KnownModels
1518
from ..config import GenerationConfig, SessionConfig
@@ -121,4 +124,4 @@ def embed_documents(self, texts: List[str]) -> List[List[float]]:
121124

122125
def embed_query(self, text: str) -> List[float]:
123126
"""Embed query text."""
124-
return self.model.embed(text)
127+
return self.model.embed(text)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ documentation = "https://llukas22.github.io/llm-rs-python/"
1818

1919
[project.optional-dependencies]
2020
convert = [ "transformers >= 4.29.0", "sentencepiece >= 0.1.99", "torch >= 2.0.0", "accelerate >= 0.19.0", "tqdm", "einops >= 0.6.1",]
21-
langchain = [ "langchain>=0.0.190",]
21+
langchain = [ "langchain>=0.0.266",]
2222

2323
haystack=[
2424
"farm-haystack>=1.17.1"

0 commit comments

Comments
 (0)