hegelai / prompttools

Open-source tools for prompt testing and experimentation, with support for both LLMs (e.g. OpenAI, LLaMA) and vector databases (e.g. Chroma, Weaviate, LanceDB).
http://prompttools.readthedocs.io
Apache License 2.0
2.55k stars 216 forks source link

GoogleVertexChatExperiment.ipynb notebook does not work #105

Open v opened 7 months ago

v commented 7 months ago

🐛 Describe the bug

I downloaded the notebook GoogleVertexChatExperiment.ipynb and tried to run it and I get this error:

----> 1 from prompttools.experiment import GoogleVertexChatCompletionExperiment
      4 model = ["chat-bison"]
      6 context = ["You are a helpful assistant.",
      7            "Answer the following question only if you know the answer or can make a well-informed guess; otherwise tell me you don't know it. In addition, explain your reasoning of your final answer."]

File ~/.pyenv/versions/3.11.5/envs/onc/lib/python3.11/site-packages/prompttools/__init__.py:7
      1 # Copyright (c) Hegel AI, Inc.
      2 # All rights reserved.
      3 #
      4 # This source code's license can be found in the
      5 # LICENSE file in the root directory of this source tree.
----> 7 from .prompttest import prompttest
      8 from .sentry import init_sentry
     11 init_sentry()

File ~/.pyenv/versions/3.11.5/envs/onc/lib/python3.11/site-packages/prompttools/prompttest/prompttest.py:13
     11 from .threshold_type import ThresholdType
     12 from .error.failure import PromptTestSetupException
---> 13 from .runner.runner import run_prompttest
     15 TESTS_TO_RUN = []
     18 def prompttest(
     19     metric_name: str,
...
     42         ),
     43         before_sleep=before_sleep_log(logging.getLogger(__name__), logging.WARNING),
     44     )

AttributeError: module 'openai' has no attribute 'APIConnectionError'

Not sure why GoogleVertexChatExperiment is depending on openai

The relevant packages I have installed locally are:

openai==1.3.4
prompttools==0.0.43

Running on Mac OSX in 3.11.5

steventkrawczyk commented 7 months ago

Can you try again with a clean virtual environment and list all the packages you are installing?

I am seeing OpenAI errors related to other installations, like langchain, e.g. https://community.openai.com/t/attributeerror-module-openai-has-no-attribute-error/486676