diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f489c5d..77a28b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: # TODO(yuanbohan): code coverage with pytest-cov - name: Test with pytest run: | - pip install pytest + pip install pytest langchain tiktoken pytest tests/ - name: Lint & Format with Ruff diff --git a/README.md b/README.md index ca72b60..4e3ad7c 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,6 @@ pip install --upgrade greptimeai ## Usage -TODO(yuanbohan): make sure this link is correct!! - To get started, create a service by registering [greptimeai][greptimeai], and get: - host @@ -33,8 +31,9 @@ export GREPTIMEAI_TOKEN='' #### LangChain LangChain provides a callback system that allows you to hook into the various stages of your LLM -application. Import GreptimeCallbackHandler, which helps to collect metrics and traces to -GreptimeCloud. +application. +Assuming you're using LangChain to empower your Application, what you need to do is just initiate +GreptimeCallbackHandler as the following: ```python from greptimeai.langchain.callback import GreptimeCallbackHandler @@ -57,7 +56,7 @@ chain.run(number=2, callbacks=callbacks) ``` This example needs to be configured with your OpenAI account's private API key which is available on -our [developer platform][openai]. Set it as the `OPENAI_API_KEY` environment variable: +[openai platform][openai]. Set it as the `OPENAI_API_KEY` environment variable: ```bash export OPENAI_API_KEY='sk-...' @@ -65,7 +64,7 @@ export OPENAI_API_KEY='sk-...' #### OpenAI -TODO +Coming [greptimeai]: https://console.greptime.cloud/ai [greptimeai-cookbook]: https://github.com/GreptimeTeam/greptimeai-cookbook diff --git a/pyproject.toml b/pyproject.toml index 3d1700a..189705f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,16 +1,14 @@ [project] name = "greptimeai" -version = "0.1.7" +version = "0.1.8" description = "Observability tool for LLM application" authors = [ { name = "Greptime", email = "info@greptime.com" }, ] dependencies = [ - "langchain>=0.0.285", "opentelemetry-api>=1.20.0", "opentelemetry-sdk>=1.20.0", "opentelemetry-exporter-otlp-proto-http>=1.20.0", - "tiktoken>=0.5.1", ] keywords = [ "greptime", @@ -23,6 +21,9 @@ keywords = [ readme = "README.md" requires-python = ">= 3.8" +[project.optional-dependencies] +openai = ["tiktoken>=0.5.1"] + [build-system] requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" @@ -32,6 +33,8 @@ managed = true dev-dependencies = [ "ruff>=0.1.3", "pytest>=7.4.3", + "langchain>=0.0.27", + "tiktoken>=0.5.1", ] [tool.rye.scripts] diff --git a/requirements.lock b/requirements.lock index c54b3a9..05b858e 100644 --- a/requirements.lock +++ b/requirements.lock @@ -7,50 +7,22 @@ # all-features: false -e file:. -aiohttp==3.8.6 -aiosignal==1.3.1 -annotated-types==0.6.0 -anyio==3.7.1 -async-timeout==4.0.3 -attrs==23.1.0 backoff==2.2.1 certifi==2023.7.22 charset-normalizer==3.3.1 -dataclasses-json==0.6.1 deprecated==1.2.14 -exceptiongroup==1.1.3 -frozenlist==1.4.0 googleapis-common-protos==1.61.0 idna==3.4 importlib-metadata==6.8.0 -jsonpatch==1.33 -jsonpointer==2.4 -langchain==0.0.325 -langsmith==0.0.53 -marshmallow==3.20.1 -multidict==6.0.4 -mypy-extensions==1.0.0 -numpy==1.24.4 opentelemetry-api==1.20.0 opentelemetry-exporter-otlp-proto-common==1.20.0 opentelemetry-exporter-otlp-proto-http==1.20.0 opentelemetry-proto==1.20.0 opentelemetry-sdk==1.20.0 opentelemetry-semantic-conventions==0.41b0 -packaging==23.2 protobuf==4.24.4 -pydantic==2.4.2 -pydantic-core==2.10.1 -pyyaml==6.0.1 -regex==2023.10.3 requests==2.31.0 -sniffio==1.3.0 -sqlalchemy==2.0.22 -tenacity==8.2.3 -tiktoken==0.5.1 typing-extensions==4.8.0 -typing-inspect==0.9.0 urllib3==2.0.7 wrapt==1.15.0 -yarl==1.9.2 zipp==3.17.0