Giter Club home page Giter Club logo

Comments (3)

louis030195 avatar louis030195 commented on May 28, 2024 1

I think I know the issue. I added aiohttp for the async stream and didn't add it to main dependency so I guess your code crashes on import. (and unit tests didn't crash because aiohttp is a dev dependency :()

I just added it to 0.1.4 which is being released. Update: https://github.com/different-ai/embedbase/releases/tag/sdk-py-0.1.4

Really sorry about that (confirm me that's the error please)

from embedbase.

louis030195 avatar louis030195 commented on May 28, 2024

I'm trying to reproduce, unit tests:

import asyncio
import os

import dotenv
import pytest
from embedbase_client import EmbedbaseAsyncClient, EmbedbaseClient

dotenv.load_dotenv("../../.env")
base_url = "https://api.embedbase.xyz"
api_key = os.environ.get("EMBEDBASE_API_KEY")
test_dataset = os.environ.get("EMBEDBASE_DATASET", "unit_test")
async_client = EmbedbaseAsyncClient(
    embedbase_url=base_url, embedbase_key=api_key, timeout=120
)

@pytest.mark.asyncio
async def test_merge_datasets():
    ds_one = f"{test_dataset}_organic_ingredients"
    ds_two = f"{test_dataset}_cake_recipes"
    await async_client.dataset(ds_one).clear()
    await async_client.dataset(ds_two).clear()
    await async_client.dataset(ds_one).batch_add(
        [
            {
                "data": "flour",
                "metadata": {"source": "organic.com", "path": "https://organic.com"},
            },
            {
                "data": "eggs",
                "metadata": {"source": "organic.com", "path": "https://organic.com"},
            },
            {
                "data": "milk",
                "metadata": {"source": "organic.com", "path": "https://organic.com"},
            },
        ]
    )
    await async_client.dataset(ds_two).batch_add(
        [
            {
                "data": "Cake recipe: 1. Mix flour, eggs and milk. 2. Bake for 30 minutes.",
                "metadata": {
                    "source": "recipe.com",
                    "path": "https://recipe.com",
                    "ingredients": ["flour", "eggs", "milk"],
                },
            }
        ]
    )

    question = "How to make a cake ?"
    [results_one, results_two] = await asyncio.gather(
        *[
            async_client.dataset(ds_one).search(question, limit=6).get(),
            async_client.dataset(ds_two).search(question, limit=1).get(),
        ]
    )
    assert len(results_one) == 3
    assert len(results_two) == 1

Is there any error?

In colab: https://colab.research.google.com/drive/1HTrFuCEDUBc8W1GBp320kJmnHRI3ri6J?usp=sharing

from embedbase.

ashgansh avatar ashgansh commented on May 28, 2024

closing this issues as it seems to be solved

@ccomkhj out to us if that's not the case :)

from embedbase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.