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

Playground can't load openai experiment #108

Closed bienpr closed 7 months ago

bienpr commented 7 months ago

⁉️ Discussion/Question

Hi

When I run playground, it didn't work with below error.

2023-11-25 19:24:35.521 Uncaught app exception
Traceback (most recent call last):
  File "/Users/sewonist/anaconda3/envs/prompttools/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script
    exec(code, module.__dict__)
  File "/Users/sewonist/Projects/13.AIChat/05.Projects/prompttools/prompttools/playground/playground.py", line 196, in <module>
    placeholders[i][j].markdown(df["response"][i + len(prompts) * j])
                                ~~^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

I added logging to data_loader.py

    print(experiment)
    # <prompttools.experiment.experiments.openai_chat_experiment.OpenAIChatExperiment object at 0x133ffe650>

    df = experiment.to_pandas_df()
    print(df) 
    # None

    return df

It looks experiment.to_pandas_df() is returned None. Is it should problem version of package?

Environments

CPU : M2 RAM : 16GB OS : Ventura 13.2.1 Python : 3.11.5 prompttools : 0.0.43

steventkrawczyk commented 7 months ago

Thanks for catching this!

This commit should fix the issue https://github.com/hegelai/prompttools/commit/2065e14d606db6de3c748db3eba8f05df95a98d6