Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: #13803

Open
Banjomaestro opened this issue May 29, 2024 · 3 comments
Open

[Bug]: #13803

Banjomaestro opened this issue May 29, 2024 · 3 comments
Labels
bug Something isn't working triage Issue needs to be triaged/prioritized

Comments

@Banjomaestro
Copy link

Bug Description

Python(43126,0x7ff845a3d7c0) malloc: *** error for object 0x55: pointer being freed was not allocated
Python(43126,0x7ff845a3d7c0) malloc: *** set a breakpoint in malloc_error_break to debug
Abort trap: 6

When trying to connect to my time scale vector database

Version

llama-index==0.10.40

Steps to Reproduce

def load_time_vector_store(namespace):
_ = load_dotenv(find_dotenv())
TIMESCALE_SERVICE_URL = os.environ["TIMESCALE_SERVICE_URL"]
vector_store = TimescaleVectorStore.from_params(
service_url=TIMESCALE_SERVICE_URL,
table_name=namespace,
)
return vector_store

Relevant Logs/Tracbacks

(myenv) myhost:project mac$ python3 main.py 
Python(43126,0x7ff845a3d7c0) malloc: *** error for object 0x55: pointer being freed was not allocated
Python(43126,0x7ff845a3d7c0) malloc: *** set a breakpoint in malloc_error_break to debug
Abort trap: 6
@Banjomaestro Banjomaestro added bug Something isn't working triage Issue needs to be triaged/prioritized labels May 29, 2024
Copy link

dosubot bot commented May 29, 2024

Hey there, @Banjomaestro! I'm here to help you with any bugs or questions you have regarding the repository. If you need assistance, feel free to ask!

To resolve the error "pointer being freed was not allocated" when trying to connect to your Timescale vector database using llama-index==0.10.40, ensure that the timescale-vector package is correctly installed and that you are using the correct client initialization.

  1. Install the timescale-vector package:

    pip install timescale-vector
  2. Initialize the clients correctly:
    Ensure your code for initializing the TimescaleVectorStore is set up properly. Here is an example of how the clients are initialized:

    def _create_clients(self) -> None:
        from timescale_vector import client
    
        id_type = "TEXT"
        if self.time_partition_interval is not None:
            id_type = "UUID"
        self._sync_client = client.Sync(
            self.service_url,
            self.table_name,
            self.num_dimensions,
            id_type=id_type,
            time_partition_interval=self.time_partition_interval,
        )
        self._async_client = client.Async(
            self.service_url,
            self.table_name,
            self.num_dimensions,
            id_type=id_type,
            time_partition_interval=self.time_partition_interval,
        )
  3. Properly close the clients:
    Make sure to properly close the clients to avoid memory issues:

    async def close(self) -> None:
        self._sync_client.close()
        await self._async_client.close()
  4. Check your environment variables:
    Ensure that the TIMESCALE_SERVICE_URL environment variable is correctly set and follows the required format.

  5. Refer to test cases:
    You can refer to the test cases provided in the llama-index-legacy/tests/vector_stores/test_timescalevector.py file to ensure that your setup and usage are correct. Here is an example:

    @pytest.mark.asyncio()
    async def test_instance_creation(db: None) -> None:
        tvs = TimescaleVectorStore.from_params(
            service_url=TEST_SERVICE_URL,
            table_name=TEST_TABLE_NAME,
        )
        assert isinstance(tvs, TimescaleVectorStore)
        await tvs.close()

If the issue persists, it might be related to a bug in the timescale-vector package or how it interacts with your environment. In such cases, consider reaching out to the maintainers of the timescale-vector package for further assistance [1][2].

Details

About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@Banjomaestro
Copy link
Author

still does not work there seems to be a bug with the from_params function

Copy link

dosubot bot commented May 30, 2024

To address the issue with the from_params function in the TimescaleVectorStore, ensure that you are using the correct parameters and that your environment is properly configured. Here is a detailed example of how to use the from_params method correctly:

  1. Ensure the timescale-vector package is installed:

    pip install timescale-vector
  2. Set up the environment variable:
    Make sure the TIMESCALE_SERVICE_URL environment variable is correctly set. It should look something like this:

    export TIMESCALE_SERVICE_URL="postgres:https://tsdbadmin:<password>@<id>.tsdb.cloud.timescale.com:<port>/tsdb?sslmode=require"
  3. Initialize the TimescaleVectorStore using from_params:
    Here is an example of how to initialize and use the TimescaleVectorStore:

    from llama_index.vector_stores.timescalevector import TimescaleVectorStore
    
    def load_time_vector_store(namespace):
        TIMESCALE_SERVICE_URL = os.environ["TIMESCALE_SERVICE_URL"]
        vector_store = TimescaleVectorStore.from_params(
            service_url=TIMESCALE_SERVICE_URL,
            table_name=namespace,
            num_dimensions=1536,  # Adjust this based on your requirements
        )
        return vector_store
    
    # Example usage
    try:
        vector_store = load_time_vector_store("your_table_name")
        # Add nodes or perform other operations
        nodes = []  # Your list of BaseNode objects
        vector_store.add(nodes)
    except Exception as e:
        print(f"An error occurred: {e}")
    finally:
        # Close the connection
        vector_store.close()
  4. Refer to test cases for correct usage:
    You can refer to the test cases provided in the repository to ensure that your setup and usage are correct. Here is an example test case:

    @pytest.mark.asyncio()
    async def test_instance_creation(db: None) -> None:
        tvs = TimescaleVectorStore.from_params(
            service_url=TEST_SERVICE_URL,
            table_name=TEST_TABLE_NAME,
        )
        assert isinstance(tvs, TimescaleVectorStore)
        await tvs.close()

If the issue persists, it might be related to a bug in the from_params function or how it interacts with your environment. Double-check the parameters and ensure that your environment variables are correctly set. If the problem continues, consider reviewing the recent changes in the repository that might affect the functionality of the TimescaleVectorStore class [1][2].

@logan-markewich, could you step in and provide your guidance?

To continue talking to Dosu, mention @dosu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Issue needs to be triaged/prioritized
Projects
None yet
Development

No branches or pull requests

1 participant