Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Commit 0c62739

Browse files
authored
Merge pull request #6 from vendi-ai/obseravabilitySdkPoC
Obseravability sdk
2 parents 0430ff2 + de7f6e5 commit 0c62739

31 files changed

+2314
-55
lines changed

examples/instrument/workflow.py

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
from vendi_sdk import Vendi
2+
import openai
3+
4+
from vendi_sdk.runtime.instrument import get_context
5+
6+
project_id = "<project_id>"
7+
8+
vendi = Vendi(
9+
api_key="<vendi_api_key>",
10+
project_id=project_id,
11+
)
12+
13+
vendi.instrument(
14+
disable_batch=True,
15+
tags={"country": "USA", "new_property": "new_value"}
16+
)
17+
18+
openai.api_key = "<openai-api-key>"
19+
20+
21+
@vendi.workflow(workflow_name="casual-chat")
22+
def empty_task():
23+
get_context().set_run_id("1119")
24+
openai.chat.completions.create(
25+
model="gpt-4-turbo",
26+
temperature=0.1,
27+
messages=[
28+
{
29+
"role": "system",
30+
"content": "You are a chatbot.",
31+
},
32+
{
33+
"role": "user",
34+
"content": "Whats is your favourite color?",
35+
},
36+
],
37+
)
38+
39+
40+
empty_task()
41+
42+
# vendi.runtime.feedback(
43+
# workflow_name="chat-2",
44+
# run_id="1235",
45+
# value={"new_status_1": "matan"},
46+
# )
47+
#

poetry.lock

+1,517-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
2-
name = "vendi"
3-
version = "0.1.24"
2+
name = "vendi-sdk"
3+
version = "0.1.1"
44
description = ""
55
authors = ["Aviv.a <[email protected]>"]
66
packages = [
@@ -16,6 +16,9 @@ pydantic = "^2.5.2"
1616
pydantic-settings = "^2.1.0"
1717
pandas = "*"
1818
aiohttp = "^3.8.1"
19+
traceloop-sdk = "^0.17.3"
20+
openai = "^1.27.0"
21+
sentry-sdk = "^2.2.0"
1922

2023

2124

src/vendi/__init__.py

-33
This file was deleted.

src/vendi_sdk/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .vendi import Vendi

src/vendi/completions/completions.py renamed to src/vendi_sdk/completions/completions.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import uuid
44
from typing import List, Dict, Optional
55

6-
from vendi.completions.schema import ChatCompletion, ModelParameters, BatchInference, BatchInferenceStatus, \
6+
from vendi_sdk.completions.schema import ChatCompletion, ModelParameters, BatchInference, BatchInferenceStatus, \
77
CompletionRequest, Endpoint, VendiCompletionResponse
8-
from vendi.core.ahttp_client import AsyncHTTPClient
9-
from vendi.core.http_client import HttpClient
8+
from vendi_sdk.core.ahttp_client import AsyncHTTPClient
9+
from vendi_sdk.core.http_client import HttpClient
1010

1111

1212
class Completions:

src/vendi/completions/schema.py renamed to src/vendi_sdk/completions/schema.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from typing import Optional, Literal
55
from pydantic import BaseModel, model_validator, ConfigDict
66

7-
from vendi.core.schema import SchemaMixin
8-
from vendi.deployments.schema import DeploymentStatus
7+
from vendi_sdk.core.schema import SchemaMixin
8+
from vendi_sdk.deployments.schema import DeploymentStatus
99

1010

1111
class ImageContentUrl(BaseModel):
File renamed without changes.
File renamed without changes.

src/vendi/core/config.py renamed to src/vendi_sdk/core/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class VendiConfig(BaseSettings):
66
"""The API key to use when making requests to the Vendi API. Use the `VENDI_API_KEY` environment variable to set this value."""
77
VENDI_API_URL: str = "https://api.vendi-ai.com"
88
"""The URL of the Vendi API. Use the `VENDI_API_URL` environment variable to set this value."""
9+
VENDI_PROJECT_ID: str | None = None
910

1011

1112
vendi_config = VendiConfig()

src/vendi/core/http_client.py renamed to src/vendi_sdk/core/http_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def post(
4141
) -> Any:
4242
_headers = self._set_headers(headers)
4343
url = self.__urljoin(uri)
44-
res = requests.post(url, json=json_data, data=data, headers=_headers)
44+
res = requests.post(url, json=json_data, data=data, headers=_headers, allow_redirects=True)
4545
return self.__handle_response(res)
4646

4747
def _set_headers(self, headers: Dict[str, str]) -> Dict[str, str]:
File renamed without changes.
File renamed without changes.

src/vendi/datasets/datasets.py renamed to src/vendi_sdk/datasets/datasets.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import pandas as pd
77

8-
from vendi.core.http_client import HttpClient
9-
from vendi.datasets.schema import Dataset, DatasetType
8+
from vendi_sdk.core.http_client import HttpClient
9+
from vendi_sdk.datasets.schema import Dataset, DatasetType
1010

1111
logger = logging.getLogger(__name__)
1212

src/vendi/datasets/schema.py renamed to src/vendi_sdk/datasets/schema.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pandas as pd
66
from pydantic import BaseModel
77

8-
from vendi.core.schema import SchemaMixin
8+
from vendi_sdk.core.schema import SchemaMixin
99

1010

1111
class DatasetType(str, Enum):

src/vendi/deployments/deployments.py renamed to src/vendi_sdk/deployments/deployments.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import List
22

3-
from vendi.core.http_client import HttpClient
3+
from vendi_sdk.core.http_client import HttpClient
44

55
from .schema import Deployment, DeploymentStatus
66

src/vendi/deployments/schema.py renamed to src/vendi_sdk/deployments/schema.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pydantic import BaseModel, ConfigDict
66

7-
from vendi.core.schema import SchemaMixin
7+
from vendi_sdk.core.schema import SchemaMixin
88

99

1010
class DeploymentStatus(str, Enum):
File renamed without changes.

src/vendi/finetune/finetune.py renamed to src/vendi_sdk/finetune/finetune.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from typing import Optional, List
22

3-
from vendi.core.http_client import HttpClient
4-
from vendi.finetune.schema import TrainData, TrainJob
5-
from vendi.models.schema import ModelInfo, ModelProvider
3+
from vendi_sdk.core.http_client import HttpClient
4+
from vendi_sdk.finetune.schema import TrainData, TrainJob
5+
from vendi_sdk.models.schema import ModelInfo, ModelProvider
66

77

88
class Finetune:

src/vendi/finetune/schema.py renamed to src/vendi_sdk/finetune/schema.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pydantic import BaseModel, ConfigDict
66

7-
from vendi.core.schema import SchemaMixin
7+
from vendi_sdk.core.schema import SchemaMixin
88

99

1010
class TrainStatus(str, Enum):
File renamed without changes.

src/vendi/models/models.py renamed to src/vendi_sdk/models/models.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from vendi.core.http_client import HttpClient
2-
from vendi.models.schema import Model, HuggingFaceModel, ModelProvider
1+
from vendi_sdk.core.http_client import HttpClient
2+
from vendi_sdk.models.schema import Model, HuggingFaceModel, ModelProvider
33

44

55
class Models:

src/vendi/models/schema.py renamed to src/vendi_sdk/models/schema.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pydantic import BaseModel, ConfigDict
66

7-
from vendi.core.schema import SchemaMixin
7+
from vendi_sdk.core.schema import SchemaMixin
88

99

1010
class ModelType(str, Enum):

src/vendi_sdk/runtime/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .runtime import Runtime

0 commit comments

Comments
 (0)