blip-solutions / promptwatch-client

Python client for PromptWatch.io - LLM tracking platform
https://www.promptwatch.io
28 stars 2 forks source link

Can't register promts #14

Closed 32r81b closed 1 year ago

32r81b commented 1 year ago

I execute code from tutorials:

from promptwatch import register_prompt_template, PromptWatch
from langchain import OpenAI, LLMChain, PromptTemplate

prompt_template = PromptTemplate.from_template("Finish this sentence {input}")
prompt_template = register_prompt_template("name_of_your_template",prompt_template)
my_chain = LLMChain(llm=OpenAI(), prompt=prompt_template)

with PromptWatch() as pw:
    my_chain("The quick brown fox jumped over")

I expect that I get new records in Promts section. While I execute code I get some warnings:

/usr/local/lib/python3.11/site-packages/langchain/callbacks/manager.py:297: RuntimeWarning: coroutine 'LangChainCallbackHandler.on_text' was never awaited
  getattr(handler, event_name)(*args, **kwargs)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.11/site-packages/langchain/callbacks/manager.py:297: RuntimeWarning: coroutine 'LangChainCallbackHandler.on_llm_start' was never awaited
  getattr(handler, event_name)(*args, **kwargs)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.11/site-packages/langchain/callbacks/manager.py:297: RuntimeWarning: coroutine 'LangChainCallbackHandler.on_llm_end' was never awaited
  getattr(handler, event_name)(*args, **kwargs)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/usr/local/lib/python3.11/site-packages/langchain/callbacks/manager.py:297: RuntimeWarning: coroutine 'LangChainCallbackHandler.on_chain_end' was never awaited
  getattr(handler, event_name)(*args, **kwargs)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

pip freeze results:

aiofiles==23.1.0
aiohttp==3.8.5
aiosignal==1.3.1
altair==5.0.1
anyio==3.7.1
async-timeout==4.0.2
attrs==23.1.0
backoff==2.2.1
beautifulsoup4==4.12.2
certifi==2023.7.22
charset-normalizer==3.2.0
chroma-hnswlib==0.7.1
chromadb==0.4.3
click==8.1.6
coloredlogs==15.0.1
contourpy==1.1.0
cycler==0.11.0
dataclasses-json==0.5.13
defopt==6.4.0
docutils==0.20.1
executing==1.2.0
Faker==19.2.0
fastapi==0.99.1
ffmpy==0.3.1
filelock==3.12.2
flatbuffers==23.5.26
fonttools==4.41.1
frozenlist==1.4.0
fsspec==2023.6.0
fvalues==0.0.4
google-search-results==2.4.2
gorilla==0.4.0
gradio==3.37.0
gradio_client==0.2.10
greenlet==2.0.2
h11==0.14.0
httpcore==0.17.3
httptools==0.6.0
httpx==0.24.1
huggingface-hub==0.16.4
humanfriendly==10.0
idna==3.4
importlib-resources==6.0.0
jaraco.context==4.3.0
Jinja2==3.1.2
joblib==1.3.1
jsonschema==4.18.4
jsonschema-specifications==2023.7.1
kiwisolver==1.4.4
langchain==0.0.237
langchain-visualizer==0.0.28
langsmith==0.0.10
Levenshtein==0.21.1
linkify-it-py==2.0.2
llama-index==0.7.11
markdown-it-py==2.2.0
MarkupSafe==2.1.3
marshmallow==3.20.1
matplotlib==3.7.2
mdit-py-plugins==0.3.3
mdurl==0.1.2
merge-args==0.1.5
monotonic==1.6
more-itertools==10.0.0
mpmath==1.3.0
multidict==6.0.4
mypy-extensions==1.0.0
nest-asyncio==1.5.6
nltk==3.8.1
numerizer==0.2.3
numexpr==2.8.4
numpy==1.25.1
onnxruntime==1.15.1
openai==0.27.8
openapi-schema-pydantic==1.2.4
orjson==3.9.2
ought-ice==0.5.0
overrides==7.3.1
packaging==23.1
pandas==2.0.3
Pillow==10.0.0
pockets==0.9.1
posthog==3.0.1
prompt-toolkit==3.0.39
promptwatch==0.2.6
protobuf==4.23.4
psycopg2-binary==2.9.6
pulsar-client==3.2.0
pycryptodome==3.18.0
pydantic==1.10.12
pydub==0.25.1
Pygments==2.15.1
pyparsing==3.0.9
pypdf==3.13.0
PyPika==0.48.9
python-dateutil==2.8.2
python-dotenv==1.0.0
python-Levenshtein==0.21.1
python-multipart==0.0.6
python-ulid==1.1.0
pytz==2023.3
PyYAML==6.0.1
questionary==1.10.0
rapidfuzz==3.1.2
referencing==0.30.0
regex==2023.6.3
requests==2.31.0
rich==13.4.2
rouge-metric==1.0.1
rpds-py==0.9.2
ruamel.yaml==0.17.32
ruamel.yaml.clib==0.2.7
safetensors==0.3.1
scikit-learn==1.3.0
scipy==1.11.1
semantic-version==2.10.0
six==1.16.0
sniffio==1.3.0
soupsieve==2.4.1
sphinxcontrib-napoleon==0.7
SQLAlchemy==2.0.19
starlette==0.27.0
structlog==23.1.0
sympy==1.12
tenacity==8.2.2
thefuzz==0.19.0
threadpoolctl==3.2.0
tiktoken==0.4.0
tokenizers==0.13.3
toolz==0.12.0
tqdm==4.65.0
transformers==4.31.0
typing-inspect==0.9.0
typing_extensions==4.7.1
tzdata==2023.3
uc-micro-py==1.0.2
urllib3==1.26.16
uvicorn==0.23.1
uvloop==0.17.0
watchfiles==0.19.0
wcwidth==0.2.6
websockets==11.0.3
wolframalpha==5.0.0
xmltodict==0.13.0
yarl==1.9.2
ju-bezdek commented 1 year ago

yeah sorry for that.. I had it already fixed locally but was holding the release ... so I did now .. please upgrade to 0.2.7 ... and let me know if it resolved your issues

Details we introduced async callbacks back in 0.2.5 ... back then langchain had a code that was deciding whether to call callbacks as coroutine or not... they made some changes and now it seems they do not handle it as gracefully...

32r81b commented 1 year ago

After upgrade to 0.2.7 i see my registered Prompts. Thank you.