llumo 0.2.3__py3-none-any.whl → 0.2.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.
llumo/functionCalling.py CHANGED
@@ -2,19 +2,19 @@ import os
2
2
  import json
3
3
  import pandas as pd
4
4
  from typing import Callable, List, Dict
5
- from dotenv import load_dotenv
6
5
  import google.generativeai as genai
7
6
  from google.generativeai.types import FunctionDeclaration, Tool
8
7
  from openai import OpenAI
9
8
  from .exceptions import *
10
- # Load environment variables
11
- load_dotenv()
9
+
12
10
  # openai_api = os.getenv("OPENAI_API_KEY")
13
11
  # google_api_key = os.getenv("GOOGLE_API_KEY")
14
12
 
15
13
 
16
14
  class LlumoAgent:
17
- def __init__(self, name: str, description: str, parameters: Dict, function: Callable):
15
+ def __init__(
16
+ self, name: str, description: str, parameters: Dict, function: Callable
17
+ ):
18
18
  self.name = name
19
19
  self.description = description
20
20
  self.parameters = parameters
@@ -30,8 +30,8 @@ class LlumoAgent:
30
30
  parameters={
31
31
  "type": "object",
32
32
  "properties": self.parameters,
33
- "required": list(self.parameters.keys())
34
- }
33
+ "required": list(self.parameters.keys()),
34
+ },
35
35
  )
36
36
 
37
37
  def createOpenaiTool(self):
@@ -44,25 +44,28 @@ class LlumoAgent:
44
44
  "type": "object",
45
45
  "properties": self.parameters,
46
46
  "required": list(self.parameters.keys()),
47
- }
48
- }
47
+ },
48
+ },
49
49
  }
50
50
 
51
51
 
52
52
  class LlumoAgentExecutor:
53
53
 
54
54
  @staticmethod
55
- def run(df: pd.DataFrame, agents: List[LlumoAgent], model: str,model_api_key = None):
55
+ def run(df: pd.DataFrame, agents: List[LlumoAgent], model: str, model_api_key=None):
56
56
  if model.lower() == "google":
57
- return LlumoAgentExecutor.runWithGoogle(df, agents,model_api_key = model_api_key)
57
+ return LlumoAgentExecutor.runWithGoogle(
58
+ df, agents, model_api_key=model_api_key
59
+ )
58
60
  elif model.lower() == "openai":
59
- return LlumoAgentExecutor.runWithOpenAI(df, agents,model_api_key = model_api_key)
61
+ return LlumoAgentExecutor.runWithOpenAI(
62
+ df, agents, model_api_key=model_api_key
63
+ )
60
64
  else:
61
65
  raise ValueError(f"Unsupported model: {model}. Use 'google' or 'openai'.")
62
66
 
63
-
64
67
  @staticmethod
65
- def runWithGoogle(df: pd.DataFrame, agents: List[LlumoAgent],model_api_key = None):
68
+ def runWithGoogle(df: pd.DataFrame, agents: List[LlumoAgent], model_api_key=None):
66
69
  try:
67
70
  genai.configure(api_key=model_api_key)
68
71
  tool_defs = []
@@ -94,7 +97,7 @@ class LlumoAgentExecutor:
94
97
  follow_up_msg = {
95
98
  "function_response": {
96
99
  "name": func_call.name,
97
- "response": result
100
+ "response": result,
98
101
  }
99
102
  }
100
103
 
@@ -119,7 +122,7 @@ class LlumoAgentExecutor:
119
122
  raise RuntimeError(f"Error in runWithGoogle: {e}")
120
123
 
121
124
  @staticmethod
122
- def runWithOpenAI(df: pd.DataFrame, agents: List[LlumoAgent],model_api_key = None):
125
+ def runWithOpenAI(df: pd.DataFrame, agents: List[LlumoAgent], model_api_key=None):
123
126
  try:
124
127
  client = OpenAI(api_key=model_api_key)
125
128
  all_tools = [agent.createOpenaiTool() for agent in agents]
@@ -137,7 +140,7 @@ class LlumoAgentExecutor:
137
140
  model="gpt-4",
138
141
  messages=messages,
139
142
  tools=all_tools,
140
- tool_choice="auto"
143
+ tool_choice="auto",
141
144
  )
142
145
 
143
146
  first_message = initial_response.choices[0].message
@@ -157,15 +160,16 @@ class LlumoAgentExecutor:
157
160
  agent = agent_lookup[tool_name]
158
161
  tool_result = agent.run(**args)
159
162
 
160
- messages.append({
161
- "role": "tool",
162
- "tool_call_id": call.id,
163
- "content": str(tool_result)
164
- })
163
+ messages.append(
164
+ {
165
+ "role": "tool",
166
+ "tool_call_id": call.id,
167
+ "content": str(tool_result),
168
+ }
169
+ )
165
170
 
166
171
  final_response = client.chat.completions.create(
167
- model="gpt-4",
168
- messages=messages
172
+ model="gpt-4", messages=messages
169
173
  )
170
174
  final_output = final_response.choices[0].message.content
171
175
  messages.append({"role": "assistant", "content": final_output})
@@ -187,4 +191,3 @@ class LlumoAgentExecutor:
187
191
 
188
192
  except Exception as e:
189
193
  raise RuntimeError(f"Error in runWithOpenAI: {e}")
190
-
llumo/helpingFuntions.py CHANGED
@@ -7,10 +7,6 @@ import requests
7
7
  import json
8
8
  import base64
9
9
  import os
10
- from dotenv import load_dotenv
11
-
12
-
13
- load_dotenv()
14
10
 
15
11
  subscriptionUrl = "https://app.llumo.ai/api/workspace/record-extra-usage"
16
12
  getStreamdataUrl = "https://app.llumo.ai/api/data-stream/all"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llumo
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Python SDK for interacting with the Llumo ai API.
5
5
  Home-page: https://www.llumo.ai/
6
6
  Author: Llumo
@@ -2,12 +2,12 @@ llumo/__init__.py,sha256=O04b4yW1BnOvcHzxWFddAKhtdBEhBNhLdb6xgnpHH_Q,205
2
2
  llumo/client.py,sha256=aCYeUrmEssSqydA_p3nokJ9MkspgitJ0HTmzL7SpkQw,35540
3
3
  llumo/exceptions.py,sha256=iCj7HhtO_ckC2EaVBdXbAudNpuMDsYmmMEV5lwynZ-E,1854
4
4
  llumo/execution.py,sha256=x88wQV8eL99wNN5YtjFaAMCIfN1PdfQVlAZQb4vzgQ0,1413
5
- llumo/functionCalling.py,sha256=QtuTtyoz5rnfNUrNT1kzegNPOrMFjrlgxZfwTqRMdiA,7190
6
- llumo/helpingFuntions.py,sha256=mDGOjeqJI1NOdoaT5FK3tlhWwhpZnk1nCnZOan0AFk0,8886
5
+ llumo/functionCalling.py,sha256=D5jYapu1rIvdIJNUYPYMTyhQ1H-6nkwoOLMi6eekfUE,7241
6
+ llumo/helpingFuntions.py,sha256=G_pqLhYNH3bZ47gA--w6YFNvB443xkrbh8CeQfYxazk,8839
7
7
  llumo/models.py,sha256=YH-qAMnShmUpmKE2LQAzQdpRsaXkFSlOqMxHwU4zBUI,1560
8
8
  llumo/sockets.py,sha256=Qxxqtx3Hg07HLhA4QfcipK1ChiOYhHZBu02iA6MfYlQ,5579
9
- llumo-0.2.3.dist-info/licenses/LICENSE,sha256=tF9yAcfPV9xGT3ViWmC8hPvOo8BEk4ZICbUfcEo8Dlk,182
10
- llumo-0.2.3.dist-info/METADATA,sha256=_Iv2gg-JKGBJvL8nEELMGJNxNUi8fBWqggI8Fas0gOY,426
11
- llumo-0.2.3.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
12
- llumo-0.2.3.dist-info/top_level.txt,sha256=d5zUTMI99llPtLRB8rtSrqELm_bOqX-bNC5IcwlDk88,6
13
- llumo-0.2.3.dist-info/RECORD,,
9
+ llumo-0.2.4.dist-info/licenses/LICENSE,sha256=tF9yAcfPV9xGT3ViWmC8hPvOo8BEk4ZICbUfcEo8Dlk,182
10
+ llumo-0.2.4.dist-info/METADATA,sha256=fccBu5Rs8SdsH-PstSiI_jeAW7Be1LR5DnG6quUdclc,426
11
+ llumo-0.2.4.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
12
+ llumo-0.2.4.dist-info/top_level.txt,sha256=d5zUTMI99llPtLRB8rtSrqELm_bOqX-bNC5IcwlDk88,6
13
+ llumo-0.2.4.dist-info/RECORD,,
File without changes