Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework LMM interface #70

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions constraints
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ anyio==4.3.0
# httpx
# openai
bandit==1.7.8
# via draive (pyproject.toml)
certifi==2024.2.2
# via
# httpcore
Expand All @@ -23,7 +24,9 @@ h11==0.14.0
httpcore==1.0.5
# via httpx
httpx==0.27.0
# via openai
# via
# draive (pyproject.toml)
# openai
idna==3.7
# via
# anyio
Expand All @@ -38,26 +41,34 @@ mdurl==0.1.2
nodeenv==1.8.0
# via pyright
numpy==1.26.4
# via draive (pyproject.toml)
openai==1.30.1
# via draive (pyproject.toml)
packaging==24.0
# via pytest
pbr==6.0.0
# via stevedore
pluggy==1.5.0
# via pytest
pydantic==2.7.1
# via openai
# via
# draive (pyproject.toml)
# openai
pydantic-core==2.18.2
# via pydantic
pygments==2.18.0
# via rich
pyright==1.1.364
# via draive (pyproject.toml)
pytest==7.4.4
# via
# draive (pyproject.toml)
# pytest-asyncio
# pytest-cov
pytest-asyncio==0.23.7
# via draive (pyproject.toml)
pytest-cov==4.1.0
# via draive (pyproject.toml)
pyyaml==6.0.1
# via bandit
regex==2024.5.15
Expand All @@ -67,6 +78,7 @@ requests==2.32.2
rich==13.7.1
# via bandit
ruff==0.4.5
# via draive (pyproject.toml)
setuptools==70.0.0
# via nodeenv
sniffio==1.3.1
Expand All @@ -77,6 +89,7 @@ sniffio==1.3.1
stevedore==5.2.0
# via bandit
tiktoken==0.7.0
# via draive (pyproject.toml)
tqdm==4.66.4
# via openai
typing-extensions==4.11.0
Expand Down
21 changes: 13 additions & 8 deletions examples/BasicConversation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -22,7 +22,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -39,18 +39,23 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\n",
" \"role\": \"assistant\",\n",
" \"content\": \"The current UTC time and date is Wednesday, 17 April 2024, 13:13:27.\",\n",
" \"identifier\": \"691610408b1c4a4ab1aecdf78da128cb\",\n",
" \"role\": \"model\",\n",
" \"author\": null,\n",
" \"created\": \"2024-04-17T13:13:28.396044+00:00\"\n",
" \"created\": \"2024-05-23T07:46:42.001814+00:00\",\n",
" \"content\": {\n",
" \"elements\": [\n",
" \"The current UTC time and date is Thursday, 23 May 2024, 07:46:41.\"\n",
" ]\n",
" }\n",
"}\n"
]
}
Expand All @@ -64,14 +69,14 @@
" Toolbox,\n",
" conversation_completion,\n",
" ctx,\n",
" openai_lmm_completion,\n",
" openai_lmm_invocation,\n",
")\n",
"\n",
"# initialize dependencies and configuration\n",
"async with ctx.new(\n",
" dependencies=[OpenAIClient], # use OpenAI client\n",
" state=[\n",
" LMM(completion=openai_lmm_completion), # define used LMM\n",
" LMM(invocation=openai_lmm_invocation), # define used LMM\n",
" OpenAIChatConfig(model=\"gpt-3.5-turbo-0125\"), # configure OpenAI model\n",
" ],\n",
"):\n",
Expand Down
6 changes: 3 additions & 3 deletions examples/BasicModelGeneration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
" OpenAIClient,\n",
" ctx,\n",
" generate_model,\n",
" openai_lmm_completion,\n",
" openai_lmm_invocation,\n",
")\n",
"\n",
"# initialize dependencies and configuration\n",
"async with ctx.new(\n",
" dependencies=[OpenAIClient], # use OpenAI client\n",
" state=[\n",
" LMM(completion=openai_lmm_completion), # define used LMM\n",
" LMM(invocation=openai_lmm_invocation), # define used LMM\n",
" OpenAIChatConfig(model=\"gpt-3.5-turbo-0125\"), # configure OpenAI model\n",
" ],\n",
"):\n",
Expand Down Expand Up @@ -98,7 +98,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "draive"
version = "0.12.1"
version = "0.13.0"
readme = "README.md"
maintainers = [
{name = "Kacper Kaliński", email = "[email protected]"}
Expand Down
Loading
Loading