Skip to content
Open
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
1 change: 1 addition & 0 deletions adalflow/adalflow/components/model_client/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"Helpers for model client for integrating models and parsing the output."

from adalflow.core.types import EmbedderOutput, Embedding, Usage


Expand Down
2 changes: 1 addition & 1 deletion adalflow/adalflow/components/retriever/bm25_retriever.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""BM25 retriever implementation. """
"""BM25 retriever implementation."""

from typing import List, Dict, Optional, Callable, Any, Sequence
import numpy as np
Expand Down
23 changes: 19 additions & 4 deletions adalflow/adalflow/components/retriever/qdrant_retriever.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
"""Leverage a Qdrant collection to retrieve documents."""

from typing import List, Optional, Any
from qdrant_client import QdrantClient, models
from adalflow.utils.lazy_import import safe_import, OptionalPackages

from adalflow.core.retriever import (
Retriever,
qdrant_module = safe_import(
OptionalPackages.QDRANT.value[0], OptionalPackages.QDRANT.value[1]
)
from adalflow.core.embedder import Embedder
print(f"QDRANT MODULE: {qdrant_module}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete print


QdrantClient = qdrant_module.QdrantClient

# Newer versions of qdrant have models lives under http.models
try:
models = qdrant_module.models
except AttributeError:
try:
models = qdrant_module.http.models # Newer versions use this
except AttributeError:
raise ImportError(
"Cannot find `models` in `qdrant_client`. Update your import path."
)

from adalflow.core.retriever import Retriever
from adalflow.core.embedder import Embedder
from adalflow.core.types import (
RetrieverOutput,
RetrieverStrQueryType,
Expand Down
3 changes: 2 additions & 1 deletion adalflow/adalflow/core/component.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Base building block for building LLM task pipelines.
It handles states recursively, such as training, components, parameters recursively along with serialization and deserialization."""
It handles states recursively, such as training, components, parameters recursively along with serialization and deserialization.
"""

from collections import OrderedDict, namedtuple
from typing import (
Expand Down
3 changes: 2 additions & 1 deletion adalflow/adalflow/core/string_parser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Extract and convert common string to Python objects.

From simple data types like boolean, integer, and float to more complex data types like JSON, YAML, and list strings."""
From simple data types like boolean, integer, and float to more complex data types like JSON, YAML, and list strings.
"""

from typing import Dict, List, Union
import logging
Expand Down
3 changes: 2 additions & 1 deletion adalflow/adalflow/eval/g_eval.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Implementation of G-Eval: G-eval <https://arxiv.org/abs/2303.08774, https://github.com/nlpyang/geval>
Instead of getting 1/5 as the score, AdalFlow will use 0.2 as the score, so that we can have a score in range [0, 1] for all metrics."""
Instead of getting 1/5 as the score, AdalFlow will use 0.2 as the score, so that we can have a score in range [0, 1] for all metrics.
"""

from enum import Enum
from typing import Dict, Any, Optional, List, Tuple
Expand Down
2 changes: 1 addition & 1 deletion adalflow/adalflow/utils/lazy_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class OptionalPackages(Enum):
"Please install datasets with: pip install datasets",
)
QDRANT = (
"qdrant-client",
"qdrant_client",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this?, please change this back

"Please install qdrant-client with: pip install qdrant-client",
)

Expand Down
714 changes: 435 additions & 279 deletions adalflow/poetry.lock

Large diffs are not rendered by default.

60 changes: 16 additions & 44 deletions adalflow/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
[tool.poetry]
name = "adalflow"

version = "1.0.3"
description = "The Library to Build and Auto-optimize LLM Applications"
authors = ["Li Yin <li@sylphai.com>"]
readme = "README.md"
repository = "https://github.com/SylphAI-Inc/AdalFlow"
license = "MIT"

maintainers = ["Li Yin <li@sylphai.com>"]
classifiers = [
"Topic :: Software Development :: Build Tools",
Expand All @@ -31,21 +29,22 @@ packages = [{ include = "adalflow", from = "." }]

[tool.poetry.dependencies]
python = ">=3.9, <4.0"

python-dotenv = "^1.0.1"
backoff = "^2.2.1"
jinja2 = "^3.1.3"
jsonlines = "^4.0.0"
tiktoken = ">=0.3.3"
numpy = "*"
numpy = [
{ version = "<2.1.0", markers = "python_version < '3.10'" },
{ version = "*", markers = "python_version >= '3.10'" }
]
tqdm = "^4.66.4"
PyYAML = ">=6.0.1"
nest-asyncio = "^1.6.0"
colorama = "^0.4.6"
diskcache = "^5.6.3"


# Optional dependencies
# Optional dependencies for the library:
openai = { version = ">=1.12.0", optional = true }
groq = { version = ">=0.9.0", optional = true }
faiss-cpu = { version = ">=1.8.0", optional = true }
Expand All @@ -57,13 +56,9 @@ google-generativeai = { version = ">=0.7.2", optional = true }
cohere = { version = ">=5.5.8", optional = true }
ollama = { version = ">=0.2.1", optional = true }
lancedb = { version = ">=0.5.2", optional = true }
# Azure dependencies

azure-core = { version = ">=1.24.0", optional = true }
azure-identity = { version = ">=1.12.0", optional = true }
# amazon bedrock
together = { version = ">=1.3.14", optional = true }

boto3 = { version = "^1.35.19", optional = true }

[tool.poetry.group.test.dependencies]
Expand All @@ -80,18 +75,13 @@ lancedb = "^0.5.2"
boto3 = "^1.35.19"
pydantic = ">=2.10.0,<2.11.0"


# TODO: cant make qdrant work here
# qdrant_client = [
# { version = ">=1.12.2,<2.0.0", optional = true, markers = "python_version >= '3.10'" },
# { version = ">=1.8.0,<1.12.2", optional = true, markers = "python_version < '3.10'" },
# ]
botocore = "^1.36.8"

[tool.poetry.group.qdrant.dependencies]
# Group dependencies are inherently optional, so `optional = true` isn't strictly needed
qdrant-client = { version = ">=1.12.2,<2.0.0", markers = "python_version >= '3.10'" }

[tool.poetry.group.typing.dependencies]
mypy = "^1"
types-pyyaml = "^6.0.12.20240311" # for mypy
types-pyyaml = "^6.0.12.20240311"
types-tqdm = "^4.66.0.20240417"

[tool.poetry.group.dev.dependencies]
Expand All @@ -104,13 +94,11 @@ azure-identity = "^1.18.0"
azure-core = "^1.31.0"
pyvis = "^0.3.2"


[tool.poetry.group.extra.dependencies]
datasets = "^2.21.0"

[tool.poetry.extras] # allow pip install adalflow[openai, groq]

# model providers
[tool.poetry.extras]
# Extras for pip install e.g. `pip install adalflow[openai, groq]`
openai = ["openai"]
groq = ["groq"]
anthropic = ["anthropic"]
Expand All @@ -119,45 +107,29 @@ google-generativeai = ["google-generativeai"]
ollama = ["ollama"]
azure = [
"azure-core",
"azure-identity",
# "azure-ai-formrecognizer",
# "azure-ai-textanalytics", # will reevaluate the need for these two
"azure-identity"
]

bedrock = ["boto3"]

together = ["together"]

# vector dbs
mistralai = ["mistralai"]
fireworks-ai = ["fireworks-ai"]
lancedb = ["lancedb"]
pgvector = ["pgvector"]
# qdrant = ["qdrant-client"]

# Removed "qdrant" extra to avoid confusion, now part of the qdrant group
datasets = ["datasets"]

# similarity search local
faiss-cpu = ["faiss-cpu"]
torch = ["torch"]

# data modeling
sqlalchemy = ["sqlalchemy"]


[[tool.poetry.source]]
name = "nvidia-pypi"
priority = "supplemental"
url = "https://pypi.nvidia.com"
# [[tool.poetry.source]]
# name = "nvidia-pypi"
# priority = "supplemental"
# url = "https://pypi.nvidia.com"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

# for formatting and linting
[tool.black]
line-length = 88
target-version = ["py311"]
Expand All @@ -167,5 +139,5 @@ exclude = ["images"]
lint.extend-ignore = [
"E402", # Ignore module-level import issues
"E731",
"UP007", # Wants | over Union, which breaks 3.8
"UP007" # Disable warning for Union types formatting in Python 3.8
]
Loading
Loading