Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

[Fix]: Update Collection name in Milvus test (#241)

patcher9e80f9601a533
diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml
index 9fc92f17..2726ddde 100644
--- a/.github/workflows/pylint.yml
+++ b/.github/workflows/pylint.yml
@@ -2,8 +2,16 @@ name: Pylint
on:
push:
+ branches: [ "main" ]
+ paths:
+ - 'sdk/python/**'
pull_request_target:
- branches: [main]
+ branches: [ "main" ]
+ paths:
+ - 'sdk/python/**'
+ workflow_dispatch:
+ schedule:
+ - cron: '0 0 1-31/15 * *'
jobs:
build:
diff --git a/sdk/python/pyproject.toml b/sdk/python/pyproject.toml
index a809625b..5f539fdd 100644
--- a/sdk/python/pyproject.toml
+++ b/sdk/python/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "openlit"
-version = "1.7.0"
+version = "1.8.0"
description = "OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications, facilitating the integration of observability into your GenAI-driven projects"
authors = ["OpenLIT"]
repository = "https://github.com/openlit/openlit/tree/main/openlit/python"
diff --git a/sdk/python/src/openlit/__helpers.py b/sdk/python/src/openlit/__helpers.py
index da89e658..aebae355 100644
--- a/sdk/python/src/openlit/__helpers.py
+++ b/sdk/python/src/openlit/__helpers.py
@@ -139,8 +139,8 @@ def fetch_pricing_info(pricing_json=None):
pricing_url = pricing_json
else:
try:
- f = open(pricing_json)
- return json.load(f)
+ with open(pricing_json, mode='r', encoding='utf-8') as f:
+ return json.load(f)
except FileNotFoundError:
logger.error("Pricing information file not found: %s", pricing_json)
except json.JSONDecodeError:
diff --git a/sdk/python/src/openlit/__init__.py b/sdk/python/src/openlit/__init__.py
index aa803206..33bbd054 100644
--- a/sdk/python/src/openlit/__init__.py
+++ b/sdk/python/src/openlit/__init__.py
@@ -146,7 +146,7 @@ def init(environment="default", application_name="default", tracer=None, otlp_en
trace_content (bool): Flag to trace content (Optional).
disabled_instrumentors (List[str]): Optional. List of instrumentor names to disable.
disable_metrics (bool): Flag to disable metrics (Optional)
- pricing_json(str): path or url to the pricing json file e.g. https://someexample.com/pricing.json or /home/user/pricing.json
+ pricing_json(str): File path or url to the pricing json (Optional)
"""
disabled_instrumentors = disabled_instrumentors if disabled_instrumentors else []
# Check for invalid instrumentor names
diff --git a/sdk/python/tests/test_milvus.py b/sdk/python/tests/test_milvus.py
index 4cbc5e48..70fe2d33 100644
--- a/sdk/python/tests/test_milvus.py
+++ b/sdk/python/tests/test_milvus.py
@@ -26,7 +26,8 @@ client = MilvusClient(
# Initialize environment and application name for OpenLIT monitoring
openlit.init(environment="openlit-testing", application_name="openlit-python-test")
-collecton_name = "openlit" + os.getenv("GITHUB_JOB")
+
+COLLECTION_NAME = "openlit"+str(os.getenv("GITHUB_RUN_ID"))+str(os.getenv("GITHUB_RUN_ATTEMPT"))
def test_db_milvus():
"""
@@ -52,7 +53,7 @@ def test_db_milvus():
# Create a new collection
collection = client.create_collection(
- collection_name=collecton_name,
+ collection_name=COLLECTION_NAME,
dimension=5
)
@@ -73,14 +74,14 @@ def test_db_milvus():
]
insert = client.insert(
- collection_name=collecton_name,
+ collection_name=COLLECTION_NAME,
data=data
)
assert insert["insert_count"] == 10
upsert = client.upsert(
- collection_name=collecton_name,
+ collection_name=COLLECTION_NAME,
data=data
)
@@ -91,7 +92,7 @@ def test_db_milvus():
]
search = client.search(
- collection_name=collecton_name,
+ collection_name=COLLECTION_NAME,
data=query_vectors,
limit=3,
)
@@ -99,7 +100,7 @@ def test_db_milvus():
assert isinstance(search[0], list)
query = client.query(
- collection_name=collecton_name,
+ collection_name=COLLECTION_NAME,
output_fields=["color"],
limit=3,
)
@@ -107,7 +108,7 @@ def test_db_milvus():
assert isinstance(query[0], dict)
getqry = client.get(
- collection_name=collecton_name,
+ collection_name=COLLECTION_NAME,
ids=[1,2,3],
output_fields=["color", "vector"]
)
@@ -115,7 +116,7 @@ def test_db_milvus():
assert isinstance(getqry[0], dict)
delt = client.delete(
- collection_name=collecton_name,
+ collection_name=COLLECTION_NAME,
filter="id in [5,6,7,8,9]"
)
@@ -123,5 +124,5 @@ def test_db_milvus():
# Delete collection
client.drop_collection(
- collection_name=collecton_name,
+ collection_name=COLLECTION_NAME,
)