euriai 0.3.27__py3-none-any.whl → 0.3.28__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/euri_chat.py CHANGED
@@ -1,10 +1,17 @@
1
1
  import requests
2
- from typing import List, Optional
2
+ from typing import List, Optional, Any, Dict
3
3
  from llama_index.core.llms import LLM
4
4
  from llama_index.core.base.llms.types import ChatMessage, CompletionResponse, CompletionResponseGen
5
5
 
6
6
 
7
7
  class EuriaiLlamaIndexLLM(LLM):
8
+ # Define class attributes as expected by Pydantic
9
+ api_key: str
10
+ model: str = "gpt-4.1-nano"
11
+ temperature: float = 0.7
12
+ max_tokens: int = 1000
13
+ url: str = "https://api.euron.one/api/v1/euri/alpha/chat/completions"
14
+
8
15
  def __init__(
9
16
  self,
10
17
  api_key: str,
@@ -21,18 +28,19 @@ class EuriaiLlamaIndexLLM(LLM):
21
28
  temperature (float, optional): Sampling temperature. Defaults to 0.7.
22
29
  max_tokens (int, optional): Maximum number of tokens. Defaults to 1000.
23
30
  """
24
- # Set default values first
25
- self.api_key = api_key
26
- self.model = model if model is not None else "gpt-4.1-nano"
27
- self.temperature = temperature if temperature is not None else 0.7
28
- self.max_tokens = max_tokens if max_tokens is not None else 1000
29
- self.url = "https://api.euron.one/api/v1/euri/alpha/chat/completions"
31
+ # Create a dictionary of parameters for the parent class
32
+ model_params = {
33
+ "api_key": api_key,
34
+ "model": model if model is not None else self.model,
35
+ "temperature": temperature if temperature is not None else self.temperature,
36
+ "max_tokens": max_tokens if max_tokens is not None else self.max_tokens,
37
+ }
30
38
 
31
- # Now initialize the parent class
32
- super().__init__()
39
+ # Initialize the parent class with the parameters
40
+ super().__init__(**model_params)
33
41
 
34
42
  @property
35
- def metadata(self):
43
+ def metadata(self) -> Dict[str, Any]:
36
44
  return {
37
45
  "context_window": 8000,
38
46
  "num_output": self.max_tokens,
euriai/euri_embed.py CHANGED
@@ -1,17 +1,24 @@
1
1
  import requests
2
2
  import numpy as np
3
+ from typing import List, Optional
3
4
  from llama_index.core.embeddings import BaseEmbedding
4
5
 
5
6
  class EuriaiLlamaIndexEmbedding(BaseEmbedding):
6
- def __init__(self, api_key: str, model: str = "text-embedding-3-small"):
7
+ # Define class attributes as expected by Pydantic
8
+ api_key: str
9
+ model: str = "text-embedding-3-small"
10
+ url: str = "https://api.euron.one/api/v1/euri/alpha/embeddings"
11
+
12
+ def __init__(self, api_key: str, model: Optional[str] = None):
7
13
  """Initialize embedding model with API key and model name."""
8
- # Set instance attributes first
9
- self.api_key = api_key
10
- self.model = model
11
- self.url = "https://api.euron.one/api/v1/euri/alpha/embeddings"
14
+ # Create parameters for the parent class
15
+ embed_params = {
16
+ "api_key": api_key,
17
+ "model": model if model is not None else self.model,
18
+ }
12
19
 
13
- # Then call the parent class constructor
14
- super().__init__()
20
+ # Initialize the parent class
21
+ super().__init__(**embed_params)
15
22
 
16
23
  def _post_embedding(self, texts):
17
24
  """Helper method to post data to API and get embeddings."""
@@ -27,10 +34,10 @@ class EuriaiLlamaIndexEmbedding(BaseEmbedding):
27
34
  response.raise_for_status()
28
35
  return [np.array(obj["embedding"]).tolist() for obj in response.json()["data"]]
29
36
 
30
- def get_text_embedding(self, text: str) -> list[float]:
37
+ def get_text_embedding(self, text: str) -> List[float]:
31
38
  """Get embedding for a single text."""
32
39
  return self._post_embedding([text])[0]
33
40
 
34
- def get_text_embeddings(self, texts: list[str]) -> list[list[float]]:
41
+ def get_text_embeddings(self, texts: List[str]) -> List[List[float]]:
35
42
  """Get embeddings for multiple texts."""
36
43
  return self._post_embedding(texts)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: euriai
3
- Version: 0.3.27
3
+ Version: 0.3.28
4
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
@@ -2,12 +2,12 @@ euriai/__init__.py,sha256=8YhbRV8s4wmNxDP9KmjOxQYLgKUCke450vnp-8-kPKs,449
2
2
  euriai/cli.py,sha256=hF1wiiL2QQSfWf8WlLQyNVDBd4YkbiwmMSoPxVbyPTM,3290
3
3
  euriai/client.py,sha256=USiqdMULgAiky7nkrJKF3FyKcOS2DtDmUdbeBSnyLYk,4076
4
4
  euriai/embedding.py,sha256=z-LLKU68tCrPi9QMs1tlKwyr7WJcjceCTkNQIFMG6vA,1276
5
- euriai/euri_chat.py,sha256=LdUxoXVwf5__Lw0GEK4vDph9mGKBYP5749L8tjT8HX4,3273
6
- euriai/euri_embed.py,sha256=EMyamZ8DtZzxoJsaRPXyOrZWuhP7GgIpKOoMXJeXHUc,1423
5
+ euriai/euri_chat.py,sha256=I2n0ubzGW7-SLp2Kg_fRJ9QLZAP-fY5rSe6azn5QF6c,3585
6
+ euriai/euri_embed.py,sha256=nwqFQ8ozMSP0xiTIf6W1QNur8SzV2OPBJRKNw7J7ouw,1650
7
7
  euriai/langchain_embed.py,sha256=OXWWxiKJ4g24TFgnWPOCZvhK7G8xtSf0ppQ2zwHkIPM,584
8
8
  euriai/langchain_llm.py,sha256=D5YvYwV7q9X2_vdoaQiPs7tNiUmjkGz-9Q-7M61hhkg,986
9
- euriai-0.3.27.dist-info/METADATA,sha256=vvXZTLD6a0-fENO3UCCM2c4avddFgdVzWHw9NlH3Hv8,3249
10
- euriai-0.3.27.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
11
- euriai-0.3.27.dist-info/entry_points.txt,sha256=9OkET8KIGcsjQn8UlnpPKRT75s2KW34jq1__1SXtpMA,43
12
- euriai-0.3.27.dist-info/top_level.txt,sha256=TG1htJ8cuD62MXn-NJ7DVF21QHY16w6M_QgfF_Er_EQ,7
13
- euriai-0.3.27.dist-info/RECORD,,
9
+ euriai-0.3.28.dist-info/METADATA,sha256=30SD7cLiZoHRa7eu-2tOjdIImn3BPEYKLdu-9_gAGZg,3249
10
+ euriai-0.3.28.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
11
+ euriai-0.3.28.dist-info/entry_points.txt,sha256=9OkET8KIGcsjQn8UlnpPKRT75s2KW34jq1__1SXtpMA,43
12
+ euriai-0.3.28.dist-info/top_level.txt,sha256=TG1htJ8cuD62MXn-NJ7DVF21QHY16w6M_QgfF_Er_EQ,7
13
+ euriai-0.3.28.dist-info/RECORD,,