Comments (3)
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.
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.
closing this issues as it seems to be solved
@ccomkhj out to us if that's not the case :)
from embedbase.
Related Issues (20)
- [Dashboard]: chat kept in state
- [Dashboard, Core, Python SDK, Javascript SDK]: publish appropriate changelog on release
- [Python SDK, Javascript SDK]: improve error handling HOT 1
- [Dashboard, Core, Python SDK, Javascript SDK]: integration unit tests concurrency issue HOT 1
- [Core]: ValueError: Out of range float values are not JSON compliant HOT 3
- [Core]: add response model
- [Core]: tiktoken stackoverflow
- [Python SDK]: ImportError: cannot import name 'EmbedbaseAsyncClient' from 'embedbase_client' HOT 1
- [Python SDK]: Where implementation in postgres db HOT 1
- [Core]: YamlModel is a deprecated class in pydantic_yaml HOT 1
- merge docs apis into a single one using wasm hacks HOT 1
- Intermittent playground crash HOT 7
- Getting started examples
- async function call not working (uvicorn, fastapi) HOT 10
- ValueError: Out of range float values are not JSON compliant HOT 2
- Add references to github and pdf uploader
- metadata unicode issue with supabase
- Add .ratio to embedbase sdk HOT 3
- [Core/Hosted]: search feedback HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from embedbase.