You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
512 B
23 lines
512 B
1 year ago
|
```python
|
||
|
from swarms.artifacts import BaseArtifact
|
||
|
from swarms.drivers import LocalVectorStoreDriver
|
||
|
from swarms.loaders import WebLoader
|
||
|
|
||
|
|
||
|
vector_store = LocalVectorStoreDriver()
|
||
|
|
||
|
[
|
||
|
vector_store.upsert_text_artifact(a, namespace="swarms")
|
||
|
for a in WebLoader(max_tokens=100).load("https://www.swarms.ai")
|
||
|
]
|
||
|
|
||
|
results = vector_store.query(
|
||
|
"creativity",
|
||
|
count=3,
|
||
|
namespace="swarms"
|
||
|
)
|
||
|
|
||
|
values = [BaseArtifact.from_json(r.meta["artifact"]).value for r in results]
|
||
|
|
||
|
print("\n\n".join(values))
|
||
|
```
|