euriai 0.3.3__py3-none-any.whl → 0.3.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- euriai/__init__.py +3 -1
- euriai/embedding.py +40 -0
- euriai/langchain_embed.py +14 -0
- {euriai-0.3.3.dist-info → euriai-0.3.4.dist-info}/METADATA +11 -2
- euriai-0.3.4.dist-info/RECORD +11 -0
- {euriai-0.3.3.dist-info → euriai-0.3.4.dist-info}/WHEEL +1 -1
- euriai-0.3.3.dist-info/RECORD +0 -9
- {euriai-0.3.3.dist-info → euriai-0.3.4.dist-info}/entry_points.txt +0 -0
- {euriai-0.3.3.dist-info → euriai-0.3.4.dist-info}/top_level.txt +0 -0
euriai/__init__.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
from .client import EuriaiClient
|
2
2
|
from .langchain_llm import EuriaiLangChainLLM
|
3
|
+
from .embedding import EuriaiEmbeddingClient
|
4
|
+
from .langchain_embed import EuriaiEmbeddings
|
3
5
|
|
4
|
-
__all__ = ["EuriaiClient", "EuriaiLangChainLLM"]
|
6
|
+
__all__ = ["EuriaiClient", "EuriaiLangChainLLM","EuriaiEmbeddingClient", "EuriaiEmbeddings"]
|
euriai/embedding.py
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
import requests
|
2
|
+
import numpy as np
|
3
|
+
|
4
|
+
class EuriaiEmbeddingClient:
|
5
|
+
def __init__(self, api_key: str, model: str = "text-embedding-3-small"):
|
6
|
+
self.api_key = api_key
|
7
|
+
self.model = model
|
8
|
+
self.url = "https://api.euron.one/api/v1/euri/alpha/embeddings"
|
9
|
+
|
10
|
+
def embed(self, text: str) -> np.ndarray:
|
11
|
+
headers = {
|
12
|
+
"Content-Type": "application/json",
|
13
|
+
"Authorization": f"Bearer {self.api_key}"
|
14
|
+
}
|
15
|
+
payload = {
|
16
|
+
"input": text,
|
17
|
+
"model": self.model
|
18
|
+
}
|
19
|
+
|
20
|
+
response = requests.post(self.url, headers=headers, json=payload)
|
21
|
+
response.raise_for_status()
|
22
|
+
data = response.json()
|
23
|
+
|
24
|
+
return np.array(data["data"][0]["embedding"])
|
25
|
+
|
26
|
+
def embed_batch(self, texts: list[str]) -> list[np.ndarray]:
|
27
|
+
headers = {
|
28
|
+
"Content-Type": "application/json",
|
29
|
+
"Authorization": f"Bearer {self.api_key}"
|
30
|
+
}
|
31
|
+
payload = {
|
32
|
+
"input": texts,
|
33
|
+
"model": self.model
|
34
|
+
}
|
35
|
+
|
36
|
+
response = requests.post(self.url, headers=headers, json=payload)
|
37
|
+
response.raise_for_status()
|
38
|
+
data = response.json()
|
39
|
+
|
40
|
+
return [np.array(obj["embedding"]) for obj in data["data"]]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from langchain_core.embeddings import Embeddings
|
2
|
+
from typing import List
|
3
|
+
from euriai.embedding import EuriaiEmbeddingClient
|
4
|
+
|
5
|
+
|
6
|
+
class EuriaiEmbeddings(Embeddings):
|
7
|
+
def __init__(self, api_key: str, model: str = "text-embedding-3-small"):
|
8
|
+
self.client = EuriaiEmbeddingClient(api_key=api_key, model=model)
|
9
|
+
|
10
|
+
def embed_documents(self, texts: List[str]) -> List[List[float]]:
|
11
|
+
return [embedding.tolist() for embedding in self.client.embed_batch(texts)]
|
12
|
+
|
13
|
+
def embed_query(self, text: str) -> List[float]:
|
14
|
+
return self.client.embed(text).tolist()
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: euriai
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.4
|
4
4
|
Summary: Python client for EURI LLM API (euron.one) with CLI and interactive wizard
|
5
5
|
Author: euron.one
|
6
6
|
Author-email: sudhanshu@euron.one
|
@@ -13,6 +13,15 @@ Requires-Python: >=3.6
|
|
13
13
|
Description-Content-Type: text/markdown
|
14
14
|
Requires-Dist: requests
|
15
15
|
Requires-Dist: langchain-core
|
16
|
+
Dynamic: author
|
17
|
+
Dynamic: author-email
|
18
|
+
Dynamic: classifier
|
19
|
+
Dynamic: description
|
20
|
+
Dynamic: description-content-type
|
21
|
+
Dynamic: license
|
22
|
+
Dynamic: requires-dist
|
23
|
+
Dynamic: requires-python
|
24
|
+
Dynamic: summary
|
16
25
|
|
17
26
|
# euriai 🧠
|
18
27
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
euriai/__init__.py,sha256=iCrFMfjSnipe5BmOdLdkCCk0dO_BZldCWD79mY67KpE,270
|
2
|
+
euriai/cli.py,sha256=hF1wiiL2QQSfWf8WlLQyNVDBd4YkbiwmMSoPxVbyPTM,3290
|
3
|
+
euriai/client.py,sha256=USiqdMULgAiky7nkrJKF3FyKcOS2DtDmUdbeBSnyLYk,4076
|
4
|
+
euriai/embedding.py,sha256=z-LLKU68tCrPi9QMs1tlKwyr7WJcjceCTkNQIFMG6vA,1276
|
5
|
+
euriai/langchain_embed.py,sha256=OXWWxiKJ4g24TFgnWPOCZvhK7G8xtSf0ppQ2zwHkIPM,584
|
6
|
+
euriai/langchain_llm.py,sha256=D5YvYwV7q9X2_vdoaQiPs7tNiUmjkGz-9Q-7M61hhkg,986
|
7
|
+
euriai-0.3.4.dist-info/METADATA,sha256=QrZomCuobKBoKfkd1-jvAKcGxzuyf8IKaGQ0va-aW9g,2105
|
8
|
+
euriai-0.3.4.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
9
|
+
euriai-0.3.4.dist-info/entry_points.txt,sha256=9OkET8KIGcsjQn8UlnpPKRT75s2KW34jq1__1SXtpMA,43
|
10
|
+
euriai-0.3.4.dist-info/top_level.txt,sha256=TG1htJ8cuD62MXn-NJ7DVF21QHY16w6M_QgfF_Er_EQ,7
|
11
|
+
euriai-0.3.4.dist-info/RECORD,,
|
euriai-0.3.3.dist-info/RECORD
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
euriai/__init__.py,sha256=MB58A0AUXMvhW9gJWK8NSpnvtGawlejvtKJ1DOhs1SM,133
|
2
|
-
euriai/cli.py,sha256=hF1wiiL2QQSfWf8WlLQyNVDBd4YkbiwmMSoPxVbyPTM,3290
|
3
|
-
euriai/client.py,sha256=USiqdMULgAiky7nkrJKF3FyKcOS2DtDmUdbeBSnyLYk,4076
|
4
|
-
euriai/langchain_llm.py,sha256=D5YvYwV7q9X2_vdoaQiPs7tNiUmjkGz-9Q-7M61hhkg,986
|
5
|
-
euriai-0.3.3.dist-info/METADATA,sha256=IHFMzYdAvNb5mROV7ozEpuA4gr8IkStYo11lx0JPEUA,1901
|
6
|
-
euriai-0.3.3.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
7
|
-
euriai-0.3.3.dist-info/entry_points.txt,sha256=9OkET8KIGcsjQn8UlnpPKRT75s2KW34jq1__1SXtpMA,43
|
8
|
-
euriai-0.3.3.dist-info/top_level.txt,sha256=TG1htJ8cuD62MXn-NJ7DVF21QHY16w6M_QgfF_Er_EQ,7
|
9
|
-
euriai-0.3.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|