agenta 0.5.5__tar.gz → 0.5.6__tar.gz

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.

Potentially problematic release.


This version of agenta might be problematic. Click here for more details.

Files changed (44) hide show
  1. {agenta-0.5.5 → agenta-0.5.6}/PKG-INFO +2 -1
  2. {agenta-0.5.5 → agenta-0.5.6}/agenta/__init__.py +1 -0
  3. {agenta-0.5.5 → agenta-0.5.6}/agenta/cli/variant_commands.py +3 -0
  4. {agenta-0.5.5 → agenta-0.5.6}/agenta/docker/docker_utils.py +15 -1
  5. {agenta-0.5.5 → agenta-0.5.6}/agenta/sdk/__init__.py +1 -0
  6. {agenta-0.5.5 → agenta-0.5.6}/agenta/sdk/agenta_decorator.py +8 -0
  7. {agenta-0.5.5 → agenta-0.5.6}/agenta/sdk/types.py +30 -0
  8. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/extract_data_to_json/app.py +4 -2
  9. {agenta-0.5.5 → agenta-0.5.6}/pyproject.toml +1 -1
  10. {agenta-0.5.5 → agenta-0.5.6}/README.md +0 -0
  11. {agenta-0.5.5 → agenta-0.5.6}/agenta/cli/helper.py +0 -0
  12. {agenta-0.5.5 → agenta-0.5.6}/agenta/cli/main.py +0 -0
  13. {agenta-0.5.5 → agenta-0.5.6}/agenta/cli/telemetry.py +0 -0
  14. {agenta-0.5.5 → agenta-0.5.6}/agenta/client/Readme.md +0 -0
  15. {agenta-0.5.5 → agenta-0.5.6}/agenta/client/__init__.py +0 -0
  16. {agenta-0.5.5 → agenta-0.5.6}/agenta/client/api_models.py +0 -0
  17. {agenta-0.5.5 → agenta-0.5.6}/agenta/client/client.py +0 -0
  18. {agenta-0.5.5 → agenta-0.5.6}/agenta/config.py +0 -0
  19. {agenta-0.5.5 → agenta-0.5.6}/agenta/config.toml +0 -0
  20. {agenta-0.5.5 → agenta-0.5.6}/agenta/docker/docker-assets/Dockerfile.cloud.template +0 -0
  21. {agenta-0.5.5 → agenta-0.5.6}/agenta/docker/docker-assets/Dockerfile.template +0 -0
  22. {agenta-0.5.5 → agenta-0.5.6}/agenta/docker/docker-assets/README.md +0 -0
  23. {agenta-0.5.5 → agenta-0.5.6}/agenta/docker/docker-assets/entrypoint.sh +0 -0
  24. {agenta-0.5.5 → agenta-0.5.6}/agenta/docker/docker-assets/lambda_function.py +0 -0
  25. {agenta-0.5.5 → agenta-0.5.6}/agenta/docker/docker-assets/main.py +0 -0
  26. {agenta-0.5.5 → agenta-0.5.6}/agenta/sdk/agenta_init.py +0 -0
  27. {agenta-0.5.5 → agenta-0.5.6}/agenta/sdk/context.py +0 -0
  28. {agenta-0.5.5 → agenta-0.5.6}/agenta/sdk/router.py +0 -0
  29. {agenta-0.5.5 → agenta-0.5.6}/agenta/sdk/utils/globals.py +0 -0
  30. {agenta-0.5.5 → agenta-0.5.6}/agenta/sdk/utils/preinit.py +0 -0
  31. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/compose_email/README.md +0 -0
  32. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/compose_email/app.py +0 -0
  33. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/compose_email/env.example +0 -0
  34. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/compose_email/requirements.txt +0 -0
  35. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/compose_email/template.toml +0 -0
  36. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/extract_data_to_json/README.md +0 -0
  37. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/extract_data_to_json/env.example +0 -0
  38. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/extract_data_to_json/requirements.txt +0 -0
  39. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/extract_data_to_json/template.toml +0 -0
  40. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/simple_prompt/README.md +0 -0
  41. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/simple_prompt/app.py +0 -0
  42. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/simple_prompt/env.example +0 -0
  43. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/simple_prompt/requirements.txt +0 -0
  44. {agenta-0.5.5 → agenta-0.5.6}/agenta/templates/simple_prompt/template.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agenta
3
- Version: 0.5.5
3
+ Version: 0.5.6
4
4
  Summary: The SDK for agenta is an open-source LLMOps platform.
5
5
  Home-page: https://agenta.ai
6
6
  Keywords: LLMOps,LLM,evaluation,prompt engineering
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3
13
13
  Classifier: Programming Language :: Python :: 3.9
14
14
  Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
16
17
  Classifier: Topic :: Software Development :: Libraries
17
18
  Requires-Dist: click (>=8.1.3,<9.0.0)
18
19
  Requires-Dist: docker (>=6.1.1,<7.0.0)
@@ -7,6 +7,7 @@ from .sdk.types import (
7
7
  InFile,
8
8
  IntParam,
9
9
  MultipleChoiceParam,
10
+ MessagesInput,
10
11
  TextParam,
11
12
  )
12
13
  from .sdk.utils.preinit import PreInitObject
@@ -119,6 +119,9 @@ def add_variant(
119
119
  image: Image = client.send_docker_tar(
120
120
  app_id, base_name, tar_path, host, api_key
121
121
  )
122
+ if tar_path.exists():
123
+ tar_path.unlink()
124
+
122
125
  # docker_image: DockerImage = build_and_upload_docker_image(
123
126
  # folder=app_path, app_name=app_name, variant_name=variant_name)
124
127
  except Exception as ex:
@@ -12,6 +12,8 @@ from docker.models.images import Image
12
12
  logger = logging.getLogger(__name__)
13
13
  logger.setLevel(logging.DEBUG)
14
14
 
15
+ DEBUG = False
16
+
15
17
 
16
18
  def create_dockerfile(out_folder: Path):
17
19
  """Creates a dockerfile based on the template in the out_folder.
@@ -47,7 +49,7 @@ def build_tar_docker_container(folder: Path, file_name: Path) -> Path:
47
49
  if tarfile_path.exists():
48
50
  tarfile_path.unlink()
49
51
 
50
- dockerfile_path = create_dockerfile(folder)
52
+ create_dockerfile(folder)
51
53
  shutil.copytree(Path(__file__).parent.parent, folder / "agenta", dirs_exist_ok=True)
52
54
  shutil.copy(Path(__file__).parent / "docker-assets" / "main.py", folder)
53
55
  shutil.copy(Path(__file__).parent / "docker-assets" / "lambda_function.py", folder)
@@ -82,6 +84,18 @@ def build_tar_docker_container(folder: Path, file_name: Path) -> Path:
82
84
  # Create the tar.gz file
83
85
  with tarfile.open(tarfile_path, "w:gz") as tar:
84
86
  tar.add(temp_path, arcname=folder.name)
87
+ if not DEBUG:
88
+ # Clean up - remove specified files and folders
89
+ for item in ["agenta", "main.py", "lambda_function.py", "entrypoint.sh"]:
90
+ path = folder / item
91
+ if path.exists():
92
+ if path.is_dir():
93
+ shutil.rmtree(path)
94
+ else:
95
+ path.unlink()
96
+
97
+ for dockerfile in folder.glob("Dockerfile*"):
98
+ dockerfile.unlink()
85
99
 
86
100
  # dockerfile_path.unlink()
87
101
  return tarfile_path
@@ -10,6 +10,7 @@ from .types import (
10
10
  IntParam,
11
11
  MultipleChoiceParam,
12
12
  TextParam,
13
+ MessagesInput,
13
14
  )
14
15
  from .agenta_init import Config, init
15
16
 
@@ -25,6 +25,7 @@ from .types import (
25
25
  IntParam,
26
26
  MultipleChoiceParam,
27
27
  TextParam,
28
+ MessagesInput,
28
29
  )
29
30
 
30
31
  app = FastAPI()
@@ -313,6 +314,7 @@ def override_schema(openapi_schema: dict, func_name: str, endpoint: str, params:
313
314
  - The min and max values for each FloatParam instance
314
315
  - The min and max values for each IntParam instance
315
316
  - The default value for DictInput instance
317
+ - The default value for MessagesParam instance
316
318
  - ... [PLEASE ADD AT EACH CHANGE]
317
319
 
318
320
  Args:
@@ -374,3 +376,9 @@ def override_schema(openapi_schema: dict, func_name: str, endpoint: str, params:
374
376
  if isinstance(param_val, TextParam):
375
377
  subschema = find_in_schema(schema_to_override, param_name, "text")
376
378
  subschema["default"] = param_val
379
+ if (
380
+ isinstance(param_val, inspect.Parameter)
381
+ and param_val.annotation is MessagesInput
382
+ ):
383
+ subschema = find_in_schema(schema_to_override, param_name, "messages")
384
+ subschema["default"] = param_val.default
@@ -98,6 +98,36 @@ class MultipleChoiceParam(str):
98
98
  )
99
99
 
100
100
 
101
+ class Message(BaseModel):
102
+ role: str
103
+ content: str
104
+
105
+
106
+ class MessagesInput(list):
107
+ """Messages Input for Chat-completion.
108
+
109
+ Parameters:
110
+ messages (List[Dict[str, str]]): The list of messages inputs.
111
+ Required. Each message should be a dictionary with "role" and "content" keys.
112
+
113
+ Raises:
114
+ ValueError: If `messages` is not specified or empty.
115
+
116
+ """
117
+
118
+ def __new__(cls, messages: List[Dict[str, str]] = None):
119
+ if not messages:
120
+ raise ValueError("Missing required parameter in MessagesInput")
121
+
122
+ instance = super().__new__(cls, messages)
123
+ instance.messages = messages
124
+ return instance
125
+
126
+ @classmethod
127
+ def __modify_schema__(cls, field_schema: dict[str, Any]):
128
+ field_schema.update({"x-parameter": "messages", "type": "array"})
129
+
130
+
101
131
  class Context(BaseModel):
102
132
  class Config:
103
133
  extra = Extra.allow
@@ -1,5 +1,7 @@
1
1
  import agenta as ag
2
- import openai
2
+ from openai import OpenAI
3
+
4
+ client = OpenAI()
3
5
  import json
4
6
 
5
7
  default_prompt = """You are a world class algorithm for extracting information in structured formats. Extract information and create a valid JSON from the following input: {text}"""
@@ -40,7 +42,7 @@ def generate(
40
42
 
41
43
  function = json.loads(ag.config.function_json)
42
44
 
43
- response = openai.ChatCompletion.create(
45
+ response = client.chat.completions.create(
44
46
  model="gpt-3.5-turbo-0613",
45
47
  messages=messages,
46
48
  temperature=ag.config.temperature,
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "agenta"
3
- version = "0.5.5"
3
+ version = "0.5.6"
4
4
  description = "The SDK for agenta is an open-source LLMOps platform."
5
5
  readme = "README.md"
6
6
  authors = ["Mahmoud Mabrouk <mahmoud@agenta.ai>"]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes