Skip to content

Commit

Permalink
Merge branch 'cloud-issue-369/-enhancement-logs-are-not-fetched-2' of…
Browse files Browse the repository at this point in the history
… github.com:agenta-ai/agenta into cloud-issue-369/-enhancement-logs-are-not-fetched-2
  • Loading branch information
bekossy committed Jun 11, 2024
2 parents 267ddc6 + b8da891 commit 98ce209
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 20 deletions.
3 changes: 1 addition & 2 deletions agenta-backend/agenta_backend/services/evaluators_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ def auto_ai_critique(
model="gpt-3.5-turbo", messages=messages, temperature=0.8
)

evaluation_output = response.choices[0].message["content"].strip()

evaluation_output = response.choices[0].message.content.strip()
return Result(type="text", value=evaluation_output)
except Exception as e: # pylint: disable=broad-except
return Result(
Expand Down
2 changes: 1 addition & 1 deletion agenta-backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "agenta_backend"
version = "0.17.1"
version = "0.17.2"
description = ""
authors = ["Mahmoud Mabrouk <[email protected]>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion agenta-cli/agenta/client/backend/types/llm_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
return super().dict(**kwargs_with_defaults)

class Config:
frozen = True
frozen = False
smart_union = True
json_encoders = {dt.datetime: serialize_datetime}
37 changes: 33 additions & 4 deletions agenta-cli/agenta/sdk/tracing/llm_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
from agenta.sdk.tracing.tasks_manager import TaskQueue
from agenta.client.backend.client import AsyncAgentaApi
from agenta.client.backend.client import AsyncObservabilityClient
from agenta.client.backend.types.create_span import CreateSpan, SpanStatusCode
from agenta.client.backend.types.create_span import (
CreateSpan,
LlmTokens,
SpanStatusCode,
)

from bson.objectid import ObjectId

Expand Down Expand Up @@ -173,6 +177,24 @@ def start_span(
def update_span_status(self, span: CreateSpan, value: str):
span.status = value

def _update_span_cost(self, span: CreateSpan, cost: Optional[float]):
if cost is not None and isinstance(cost, float):
if span.cost is None:
span.cost = cost
else:
span.cost += cost

def _update_span_tokens(self, span: CreateSpan, tokens: Optional[dict]):
if isinstance(tokens, LlmTokens):
tokens = tokens.dict()
if tokens is not None and isinstance(tokens, dict):
if span.tokens is None:
span.tokens = LlmTokens(**tokens)
else:
span.tokens.prompt_tokens += tokens["prompt_tokens"]
span.tokens.completion_tokens += tokens["completion_tokens"]
span.tokens.total_tokens += tokens["total_tokens"]

def end_span(self, outputs: Dict[str, Any]):
"""
Ends the active span, if it is a parent span, ends the trace too.
Expand All @@ -196,8 +218,12 @@ def end_span(self, outputs: Dict[str, Any]):

self.active_span.end_time = datetime.now(timezone.utc)
self.active_span.outputs = [outputs.get("message", "")]
self.active_span.cost = outputs.get("cost", None)
self.active_span.tokens = outputs.get("usage", None)
if self.active_span.spankind in [
"LLM",
"RETRIEVER",
]: # TODO: Remove this whole part. Setting the cost should be done through set_span_attribute
self._update_span_cost(self.active_span, outputs.get("cost", None))
self._update_span_tokens(self.active_span, outputs.get("usage", None))

# Push span to list of recorded spans
self.pending_spans.append(self.active_span)
Expand All @@ -213,7 +239,10 @@ def end_span(self, outputs: Dict[str, Any]):
self.end_trace(parent_span=self.active_span)

else:
self.active_span = self.span_dict.get(active_span_parent_id)
parent_span = self.span_dict[active_span_parent_id]
self._update_span_cost(parent_span, self.active_span.cost)
self._update_span_tokens(parent_span, self.active_span.tokens)
self.active_span = parent_span

def record_exception_and_end_trace(self, span_parent_id: str):
"""
Expand Down
2 changes: 1 addition & 1 deletion agenta-cli/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "agenta"
version = "0.17.1"
version = "0.17.2"
description = "The SDK for agenta is an open-source LLMOps platform."
readme = "README.md"
authors = ["Mahmoud Mabrouk <[email protected]>"]
Expand Down
4 changes: 2 additions & 2 deletions agenta-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion agenta-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "agenta",
"version": "0.17.1",
"version": "0.17.2",
"private": true,
"engines": {
"node": ">=18"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ services:
- DATABASE_MODE=test
- FEATURE_FLAG=oss
- OPENAI_API_KEY=${OPENAI_API_KEY}
- AGENTA_TEMPLATE_REPO=agentaai/stage_templates
- AGENTA_TEMPLATE_REPO=agentaai/templates_v2
- POSTHOG_API_KEY=phc_hmVSxIjTW1REBHXgj2aw4HW9X6CXb6FzerBgP9XenC7
- TEMPLATES_BASE_URL=https://llm-app-json.s3.eu-central-1.amazonaws.com
- REGISTRY_REPO_NAME=agentaai
Expand Down
Binary file added docs/images/misc/team_management_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/misc/team_management_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/misc/workspace_tab_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/misc/workspace_tab_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 17 additions & 7 deletions docs/misc/team_management.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,29 @@
title: 'Team Management'
---

<Note> Role-based access control and audit trails are currently under development. </Note>
## Inviting users

To add new users to your workspace, start by clicking on **Settings** in the lower left corner of the screen. Then, navigate to the **Workspace** tab and on the far right, you will find the **Invite** button. Clicking this button will open a modal window where you can enter the email address(es) of the user(s) you wish to invite and select their role from a dropdown menu. Once you have entered the necessary information, click the **"Invite"** button to send the invitation. The user(s) will then receive an email invitation to join your workspace.

## Inviting users
<img height="600" className="dark:hidden" src="/images/misc/team_management_light.png" />
<img height="600" className="hidden dark:block" src="/images/misc/team_management_dark.png" />

### User Roles and Their Rights
- **Owner**: The Owner has full management capabilities within the workspace. This includes adding and removing members, as well as managing all settings and content. Essentially, the Owner has unrestricted access to all features and controls.

- **Workspace Admin**: A Workspace Admin can manage most aspects of the workspace, including settings and member management. However, they do not have the authority to delete the workspace itself.

- **Editor**: Editors are responsible for editing workspace content. They do not have the ability to manage members or assign roles, focusing solely on content management.

- **Evaluator**: Evaluators are tasked with evaluating models and providing feedback. They do not have editing privileges or member management rights, ensuring their role is concentrated on assessment and feedback.

To add new users to your workspace, click on settings in the lower left corner of the screen. Then select the "Workspace" tab. You can invite new users by entering their email addresses.
- **Deployment Manager**: Deployment Managers handle the management of model deployments within the workspace. Similar to Evaluators, they do not have content editing or member management rights, allowing them to specialize in deployment tasks.

<img height="600" className="dark:hidden" src="/images/basic_guides/12_workspace_config_light.png" />
<img height="600" className="hidden dark:block" src="/images/basic_guides/12_workspace_config_dark.png" />
- **Viewer**: Viewers can access and view all workspace content, but they are restricted from making any changes or managing members and roles. This role is typically for those who need to monitor progress without intervening in the workspace operations.

## Switching workspaces

If you're a member of multiple workspaces, you can switch between them by clicking the workspace name in the lower left corner of the screen. Remember, all applications in a workspace are shared among all its members.

<img height="600" className="dark:hidden" src="/images/basic_guides/13_workspace_tab_light.png" />
<img height="600" className="hidden dark:block" src="/images/basic_guides/13_workspace_tab_dark.png" />
<img height="600" className="dark:hidden" src="/images/misc/workspace_tab_light.png" />
<img height="600" className="hidden dark:block" src="/images/misc/workspace_tab_dark.png" />

0 comments on commit 98ce209

Please sign in to comment.