euriai 0.3.7__py3-none-any.whl → 0.3.9__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/llamaindex/__init__.py +0 -0
- euriai/llamaindex/euri_chat.py +31 -0
- euriai/llamaindex/euri_embed.py +28 -0
- {euriai-0.3.7.dist-info → euriai-0.3.9.dist-info}/METADATA +4 -2
- euriai-0.3.9.dist-info/RECORD +14 -0
- euriai-0.3.7.dist-info/RECORD +0 -11
- {euriai-0.3.7.dist-info → euriai-0.3.9.dist-info}/WHEEL +0 -0
- {euriai-0.3.7.dist-info → euriai-0.3.9.dist-info}/entry_points.txt +0 -0
- {euriai-0.3.7.dist-info → euriai-0.3.9.dist-info}/top_level.txt +0 -0
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import requests
|
2
|
+
from llama_index.llms.base import LLM, ChatMessage, CompletionResponse
|
3
|
+
from typing import List
|
4
|
+
|
5
|
+
class EuriaiLlamaIndexLLM(LLM):
|
6
|
+
def __init__(self, api_key: str, model: str = "gpt-4.1-nano", temperature: float = 0.7, max_tokens: int = 1000):
|
7
|
+
self.api_key = api_key
|
8
|
+
self.model = model
|
9
|
+
self.temperature = temperature
|
10
|
+
self.max_tokens = max_tokens
|
11
|
+
self.url = "https://api.euron.one/api/v1/chat/completions"
|
12
|
+
|
13
|
+
def complete(self, prompt: str, **kwargs) -> CompletionResponse:
|
14
|
+
return self.chat([ChatMessage(role="user", content=prompt)])
|
15
|
+
|
16
|
+
def chat(self, messages: List[ChatMessage], **kwargs) -> CompletionResponse:
|
17
|
+
payload = {
|
18
|
+
"messages": [{"role": m.role, "content": m.content} for m in messages],
|
19
|
+
"model": self.model,
|
20
|
+
"temperature": self.temperature,
|
21
|
+
"max_tokens": self.max_tokens
|
22
|
+
}
|
23
|
+
headers = {
|
24
|
+
"Content-Type": "application/json",
|
25
|
+
"Authorization": f"Bearer {self.api_key}"
|
26
|
+
}
|
27
|
+
response = requests.post(self.url, headers=headers, json=payload)
|
28
|
+
response.raise_for_status()
|
29
|
+
result = response.json()
|
30
|
+
content = result["choices"][0]["message"]["content"]
|
31
|
+
return CompletionResponse(text=content)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import requests
|
2
|
+
import numpy as np
|
3
|
+
from llama_index.embeddings.base import BaseEmbedding
|
4
|
+
|
5
|
+
class EuriaiLlamaIndexEmbedding(BaseEmbedding):
|
6
|
+
def __init__(self, api_key: str, model: str = "text-embedding-3-small"):
|
7
|
+
self.api_key = api_key
|
8
|
+
self.model = model
|
9
|
+
self.url = "https://api.euron.one/api/v1/euri/alpha/embeddings"
|
10
|
+
|
11
|
+
def _post_embedding(self, texts):
|
12
|
+
headers = {
|
13
|
+
"Content-Type": "application/json",
|
14
|
+
"Authorization": f"Bearer {self.api_key}"
|
15
|
+
}
|
16
|
+
payload = {
|
17
|
+
"input": texts,
|
18
|
+
"model": self.model
|
19
|
+
}
|
20
|
+
response = requests.post(self.url, headers=headers, json=payload)
|
21
|
+
response.raise_for_status()
|
22
|
+
return [np.array(obj["embedding"]).tolist() for obj in response.json()["data"]]
|
23
|
+
|
24
|
+
def get_text_embedding(self, text: str) -> list[float]:
|
25
|
+
return self._post_embedding([text])[0]
|
26
|
+
|
27
|
+
def get_text_embeddings(self, texts: list[str]) -> list[list[float]]:
|
28
|
+
return self._post_embedding(texts)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: euriai
|
3
|
-
Version: 0.3.
|
4
|
-
Summary: Python client for EURI LLM API (euron.one) with CLI and
|
3
|
+
Version: 0.3.9
|
4
|
+
Summary: Python client for EURI LLM API (euron.one) with CLI, LangChain, and LlamaIndex integration
|
5
5
|
Author: euron.one
|
6
6
|
Author-email: sudhanshu@euron.one
|
7
7
|
License: MIT
|
@@ -13,6 +13,8 @@ Requires-Python: >=3.6
|
|
13
13
|
Description-Content-Type: text/markdown
|
14
14
|
Requires-Dist: requests
|
15
15
|
Requires-Dist: langchain-core
|
16
|
+
Requires-Dist: llama-index<0.11.0,>=0.10.0
|
17
|
+
Requires-Dist: numpy
|
16
18
|
Dynamic: author
|
17
19
|
Dynamic: author-email
|
18
20
|
Dynamic: classifier
|
@@ -0,0 +1,14 @@
|
|
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/llamaindex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
+
euriai/llamaindex/euri_chat.py,sha256=wvSiNLzvq0Jp8jYif3QDHCfjbodDmQbiuIOIrXEu_Mc,1332
|
9
|
+
euriai/llamaindex/euri_embed.py,sha256=HtbjbCBvKka77hpHPlTI1pX28uUL9L3eKbT69rkt4i8,1058
|
10
|
+
euriai-0.3.9.dist-info/METADATA,sha256=eMqkrd5CTa4Af9fiS25ZPmB3KPF_x3OrRAGfjdnIDDk,3256
|
11
|
+
euriai-0.3.9.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
12
|
+
euriai-0.3.9.dist-info/entry_points.txt,sha256=9OkET8KIGcsjQn8UlnpPKRT75s2KW34jq1__1SXtpMA,43
|
13
|
+
euriai-0.3.9.dist-info/top_level.txt,sha256=TG1htJ8cuD62MXn-NJ7DVF21QHY16w6M_QgfF_Er_EQ,7
|
14
|
+
euriai-0.3.9.dist-info/RECORD,,
|
euriai-0.3.7.dist-info/RECORD
DELETED
@@ -1,11 +0,0 @@
|
|
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.7.dist-info/METADATA,sha256=7tXdBoErthPhwGELFJ_xfjq_JRNic8HtYZlcyKM58xE,3174
|
8
|
-
euriai-0.3.7.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
9
|
-
euriai-0.3.7.dist-info/entry_points.txt,sha256=9OkET8KIGcsjQn8UlnpPKRT75s2KW34jq1__1SXtpMA,43
|
10
|
-
euriai-0.3.7.dist-info/top_level.txt,sha256=TG1htJ8cuD62MXn-NJ7DVF21QHY16w6M_QgfF_Er_EQ,7
|
11
|
-
euriai-0.3.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|