Skip to content

Example in the Docs does not work #229

@zixiao-ye

Description

@zixiao-ye

Bug Description

The code in the Docs "GETTING STARTED" examples does not work.

Expected Behavior

Steps to Reproduce

Just follow the Docs installation and than run the example code locally

Environment Information

Operating System:

  • macOS
  • Linux
  • Windows
  • Other (please specify)

Python Version:
Python 3.10

Package Versions:

Error Messages and Logs

Traceback (most recent call last):
File "/Users/lotus_example.py", line 3, in
import lotus
File "/opt/anaconda3/envs/lotus/lib/python3.10/site-packages/lotus/init.py", line 4, in
import lotus.vector_store
File "/opt/anaconda3/envs/lotus/lib/python3.10/site-packages/lotus/vector_store/init.py", line 2, in
from lotus.vector_store.faiss_vs import FaissVS
File "/opt/anaconda3/envs/lotus/lib/python3.10/site-packages/lotus/vector_store/faiss_vs.py", line 5, in
import faiss
File "/opt/anaconda3/envs/lotus/lib/python3.10/site-packages/faiss/init.py", line 16, in
from .loader import *
File "/opt/anaconda3/envs/lotus/lib/python3.10/site-packages/faiss/loader.py", line 98, in
from .swigfaiss import *
File "/opt/anaconda3/envs/lotus/lib/python3.10/site-packages/faiss/swigfaiss.py", line 810, in
class PartitionStats(object):
File "/opt/anaconda3/envs/lotus/lib/python3.10/site-packages/faiss/swigfaiss.py", line 813, in PartitionStats
bissect_cycles = property(_swigfaiss.PartitionStats_bissect_cycles_get, _swigfaiss.PartitionStats_bissect_cycles_set)
AttributeError: module 'faiss._swigfaiss' has no attribute 'PartitionStats_bissect_cycles_get'

Screenshots

Minimal Reproduction Example

conda create -n lotus python=3.10 -y
conda activate lotus
pip install lotus-ai

conda install -c pytorch faiss-cpu=1.8.0

python lotus_example.py

Where lotus_example.py is exactly same as the code provided in the Docs GETTING_STARTED examples:

import pandas as pd

import lotus
from lotus.models import SentenceTransformersRM, LM
from lotus.vector_store import FaissVS

# Configure models for LOTUS
lm = LM(model="gpt-4o-mini")
rm = SentenceTransformersRM(model="intfloat/e5-base-v2")
vs = FaissVS()

lotus.settings.configure(lm=lm, rm=rm, vs=vs)



# Dataset containing courses and their descriptions/workloads
data = [
    (
        "Probability and Random Processes",
        "Focuses on markov chains and convergence of random processes. The workload is pretty high.",
    ),
    (
        "Deep Learning",
        "Fouces on theory and implementation of neural networks. Workload varies by professor but typically isn't terrible.",
    ),
    (
        "Digital Design and Integrated Circuits",
        "Focuses on building RISC-V CPUs in Verilog. Students have said that the workload is VERY high.",
    ),
    (
        "Databases",
        "Focuses on implementation of a RDBMS with NoSQL topics at the end. Most students say the workload is not too high.",
    ),
]
df = pd.DataFrame(data, columns=["Course Name", "Description"])

# Applies semantic filter followed by semantic aggregation
ml_df = df.sem_filter("{Description} indicates that the class is relevant for machine learning.")
tips = ml_df.sem_agg(
    "Given each {Course Name} and its {Description}, give me a study plan to succeed in my classes."
)._output[0]

Additional Context

Checklist

  • I have searched existing issues to avoid duplicates
  • I have provided all required information
  • I have tested with the latest version of the package
  • I have included a minimal reproduction example (if applicable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions