Skip to content

Commit

Permalink
chore: migrate tach config from YAML to TOML and add voyage provider …
Browse files Browse the repository at this point in the history
…tests

Co-Authored-By: Alex Reibman <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and areibman committed Dec 12, 2024
1 parent f065f50 commit 7cf6400
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 20 deletions.
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ langchain = [
ci = [
"tach~=0.9",
]

voyage = [
"voyageai>=0.1.0"
]

[project.urls]
Homepage = "https://github.com/AgentOps-AI/agentops"
Expand Down
26 changes: 26 additions & 0 deletions tach.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
exclude = [
".*__pycache__",
".*egg-info",
"docs",
"examples",
"tests",
"venv",
]
source_roots = [
".",
]

[[modules]]
path = "agentops"
depends_on = [
{ path = "agentops.enums" },
{ path = "agentops.log_config" },
]

[[modules]]
path = "agentops.enums"
depends_on = []

[[modules]]
path = "agentops.log_config"
depends_on = []
19 changes: 0 additions & 19 deletions tach.yml

This file was deleted.

35 changes: 35 additions & 0 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,41 @@ def test_export_llm_event(self, mock_req):
assert event["init_timestamp"] is not None
assert event["end_timestamp"] is not None

def test_voyage_provider(self, mock_req):
from agentops.llms.providers.voyage import VoyageProvider

provider = VoyageProvider()
assert provider is not None

voyage_attributes = {
"event.data": json.dumps(
{
"prompt": "test voyage prompt",
"completion": "test voyage completion",
"model": "voyage-01",
"tokens": 150,
"cost": 0.003,
}
)
}

span = self.create_test_span(name="llms", attributes=voyage_attributes)
result = self.exporter.export([span])

assert result == SpanExportResult.SUCCESS

last_request = mock_req.request_history[-1].json()
event = last_request["events"][0]

assert event["prompt"] == "test voyage prompt"
assert event["completion"] == "test voyage completion"
assert event["model"] == "voyage-01"
assert event["tokens"] == 150
assert event["cost"] == 0.003

assert event["init_timestamp"] is not None
assert event["end_timestamp"] is not None

def test_export_with_missing_id(self, mock_req):
"""Test handling of missing event ID"""
attributes = {"event.id": None}
Expand Down

0 comments on commit 7cf6400

Please sign in to comment.