Skip to content

Commit 0030eb2

Browse files
committed
chore: setup docs foundation
1 parent 573c3a1 commit 0030eb2

File tree

15 files changed

+344
-250
lines changed

15 files changed

+344
-250
lines changed

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

example.py

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,42 @@
22

33
### Intialize the Orquesta client
44

5-
client_options = OrquestaClientOptions(
5+
options = OrquestaClientOptions(
66
api_key="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ3b3Jrc3BhY2VJZCI6ImUzYTIwMmE2LTQ2MWItNDQ3Yy1hYmUyLTAxOGJhNGQwNGNkMCIsImlhdCI6MTY5NzEyNTQ1NDczN30.3kBW_RfS104S2DAlSvPpr3tQiq15nTxNuUv2gE0Nxd0",
77
environment="production",
88
)
99

10-
client = Orquesta(options=client_options)
10+
client = Orquesta(options)
1111

12-
deployment = client.deployments.invoke_with_stream(
13-
key="withFallback", metadata={"name": "test"}
12+
deployment = client.deployments.get_config(
13+
key="withFallback",
14+
context={"environments": "production", "country": "NLD"},
15+
inputs={"firstname": "John", "city": "New York"},
16+
metadata={"customer_id": "Qwtqwty90281"},
1417
)
1518

16-
for chunk in deployment:
17-
if chunk.is_final:
18-
print("Stream is finished")
19+
print(deployment.to_dict())
20+
21+
deployment.add_metrics(
22+
chain_id="c4a75b53-62fa-401b-8e97-493f3d299316",
23+
conversation_id="ee7b0c8c-eeb2-43cf-83e9-a4a49f8f13ea",
24+
user_id="e3a202a6-461b-447c-abe2-018ba4d04cd0",
25+
feedback={"score": 100},
26+
metadata={
27+
"custom": "custom_metadata",
28+
"chain_id": "ad1231xsdaABw",
29+
},
30+
usage={
31+
"prompt_tokens": 100,
32+
"completion_tokens": 900,
33+
"total_tokens": 1000,
34+
},
35+
performance={
36+
"latency": 9000,
37+
"time_to_first_token": 250,
38+
},
39+
)
40+
41+
# for chunk in deployment:
42+
# if chunk.is_final:
43+
# print("Stream is finished")

examples/deployment-with-image.ipynb

Whitespace-only changes.

make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

mkdocs.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
site_name: "Orquesta's Python SDK"
2+
3+
theme:
4+
name: "readthedocs"
5+
6+
plugins:
7+
- search
8+
- mkdocstrings:
9+
default_handler: python
10+
11+
sphinx:
12+
configuration: source/conf.py

orquesta_sdk/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
api_key: str | None = None
2-
3-
41
from .client import Orquesta
52
from .options import OrquestaClientOptions

orquesta_sdk/api_resources/deployments.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from orquesta_sdk.options import OrquestaClientOptions
88
from orquesta_sdk.util import extract_json
99

10-
DEPLOYMENTS_API = "https://preview.orquesta.cloud/v2/deployments"
10+
DEPLOYMENTS_API = "https://api.orquesta.cloud/v2/deployments"
1111

1212
GET_CONFIG_URL = "{}/get_config".format(DEPLOYMENTS_API)
1313
INVOKE_URL = "{}/invoke".format(DEPLOYMENTS_API)
@@ -187,6 +187,13 @@ def __init__(
187187
self.choices = [DeploymentDataChoice(choice) for choice in choices]
188188

189189
def to_dict(self):
190+
"""
191+
Converts the deployment object to a dictionary representation.
192+
193+
Returns:
194+
dict: A dictionary representation of the deployment object.
195+
196+
"""
190197
return {
191198
"id": self.id,
192199
"created": self.created,
@@ -371,8 +378,6 @@ def invoke_with_stream(self, key: str, context=None, inputs=None, metadata=None)
371378
key=key, context=context, variables=inputs, metadata=metadata
372379
)
373380

374-
stream = self.body_params.get("stream", False)
375-
376381
response = post(
377382
url=INVOKE_URL,
378383
api_key=self.options.api_key,

orquesta_sdk/client.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@
77

88

99
class Orquesta:
10+
"""
11+
Represents an Orquesta client.
12+
13+
Args:
14+
options (OrquestaClientOptions): The options for the Orquesta client.
15+
16+
Attributes:
17+
deployments (Deployments): An instance of the Deployments class.
18+
19+
Raises:
20+
OrquestaInvalidAPIException: If the provided API key is invalid.
21+
"""
22+
1023
def __init__(self, options: OrquestaClientOptions):
1124
api_key = options.api_key or os.environ.get("ORQUESTA_API_KEY")
1225

pyproject.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "orquesta_sdk"
3-
version = "1.11.6"
3+
version = '2.0.0rc1'
44
description = "_LLM Operations and Integration Platform_"
55
authors = ["Orquesta <info@orquesta.dev>"]
66
classifiers = [
@@ -23,10 +23,11 @@ readme = "README.md"
2323

2424

2525
[tool.poetry.dependencies]
26-
python = ">=3.8,<4.0.0"
26+
python = ">=3.9,<4.0.0"
2727
requests = "^2.28.2"
2828
httpx = "^0.25.2"
2929

30+
3031
[tool.poetry.dev-dependencies]
3132
black = "^21.9b0"
3233
pytest = "^6.2.5"
@@ -36,6 +37,10 @@ tox = "^3.24.4"
3637
tox-pyenv = "^1.1.0"
3738
pytest-watch = "^4.2.0"
3839

40+
[tool.poetry.group.dev.dependencies]
41+
mkdocs = "^1.5.3"
42+
sphinx = "^7.2.6"
43+
3944
[build-system]
4045
requires = ["poetry-core>=1.0.0"]
4146
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)