pull/334/head
Kye 1 year ago
parent acdcdd61a6
commit aa5f4477f7

@ -344,9 +344,48 @@ img = "playground/demos/multi_modal_chain_of_thought/eyetest.jpg"
# Run the workflow on a task
out = llm.run(task=task, img=img)
print(out)
```
### `Anthropic`
```python
# Import necessary modules and classes
from swarms.models import Anthropic
# Initialize an instance of the Anthropic class
model = Anthropic(
anthropic_api_key=""
)
# Using the run method
completion_1 = model.run("What is the capital of France?")
print(completion_1)
# Using the __call__ method
completion_2 = model("How far is the moon from the earth?", stop=["miles", "km"])
print(completion_2)
```
### `HuggingFaceLLM`
```python
from swarms.models import HuggingfaceLLM
# Initialize with custom configuration
custom_config = {
"quantize": True,
"quantization_config": {"load_in_4bit": True},
"verbose": True
}
inference = HuggingfaceLLM(model_id="NousResearch/Nous-Hermes-2-Vision-Alpha", **custom_config)
# Generate text based on a prompt
prompt_text = "Create a list of known biggest risks of structural collapse with references"
generated_text = inference(prompt_text)
print(generated_text)
```
---
# Features 🤖

@ -1,4 +1,4 @@
# `PineconDB` Documentation
# `PineconeDB` Documentation
## Table of Contents

@ -106,7 +106,7 @@ nav:
- Conversation: "swarms/structs/conversation.md"
- swarms.memory:
- Weaviate: "swarms/memory/weaviate.md"
- PineconDB: "swarms/memory/pinecone.md"
- PineconeDB: "swarms/memory/pinecone.md"
- PGVectorStore: "swarms/memory/pg.md"
- ShortTermMemory: "swarms/memory/short_term_memory.md"
- swarms.utils:

@ -6,9 +6,9 @@ from swarms.utils.hash import str_to_hash
@define
class PineconDB(VectorDatabase):
class PineconeDB(VectorDatabase):
"""
PineconDB is a vector storage driver that uses Pinecone as the underlying storage engine.
PineconeDB is a vector storage driver that uses Pinecone as the underlying storage engine.
Pinecone is a vector database that allows you to store, search, and retrieve high-dimensional vectors with
blazing speed and low latency. It is a managed service that is easy to use and scales effortlessly, so you can
@ -34,14 +34,14 @@ class PineconDB(VectorDatabase):
Creates a new index.
Usage:
>>> from swarms.memory.vector_stores.pinecone import PineconDB
>>> from swarms.memory.vector_stores.pinecone import PineconeDB
>>> from swarms.utils.embeddings import USEEmbedding
>>> from swarms.utils.hash import str_to_hash
>>> from swarms.utils.dataframe import dataframe_to_hash
>>> import pandas as pd
>>>
>>> # Create a new PineconDB instance:
>>> pv = PineconDB(
>>> # Create a new PineconeDB instance:
>>> pv = PineconeDB(
>>> api_key="your-api-key",
>>> index_name="your-index-name",
>>> environment="us-west1-gcp",
@ -166,7 +166,7 @@ class PineconDB(VectorDatabase):
count: Optional[int] = None,
namespace: Optional[str] = None,
include_vectors: bool = False,
# PineconDBStorageDriver-specific params:
# PineconeDBStorageDriver-specific params:
include_metadata=True,
**kwargs,
):

@ -1,6 +1,6 @@
import os
from unittest.mock import patch
from swarms.memory.pinecone import PineconDB
from swarms.memory.pinecone import PineconeDB
api_key = os.getenv("PINECONE_API_KEY") or ""
@ -9,7 +9,7 @@ def test_init():
with patch("pinecone.init") as MockInit, patch(
"pinecone.Index"
) as MockIndex:
store = PineconDB(
store = PineconeDB(
api_key=api_key,
index_name="test_index",
environment="test_env",
@ -21,7 +21,7 @@ def test_init():
def test_upsert_vector():
with patch("pinecone.init"), patch("pinecone.Index") as MockIndex:
store = PineconDB(
store = PineconeDB(
api_key=api_key,
index_name="test_index",
environment="test_env",
@ -37,7 +37,7 @@ def test_upsert_vector():
def test_load_entry():
with patch("pinecone.init"), patch("pinecone.Index") as MockIndex:
store = PineconDB(
store = PineconeDB(
api_key=api_key,
index_name="test_index",
environment="test_env",
@ -48,7 +48,7 @@ def test_load_entry():
def test_load_entries():
with patch("pinecone.init"), patch("pinecone.Index") as MockIndex:
store = PineconDB(
store = PineconeDB(
api_key=api_key,
index_name="test_index",
environment="test_env",
@ -59,7 +59,7 @@ def test_load_entries():
def test_query():
with patch("pinecone.init"), patch("pinecone.Index") as MockIndex:
store = PineconDB(
store = PineconeDB(
api_key=api_key,
index_name="test_index",
environment="test_env",
@ -72,7 +72,7 @@ def test_create_index():
with patch("pinecone.init"), patch("pinecone.Index"), patch(
"pinecone.create_index"
) as MockCreateIndex:
store = PineconDB(
store = PineconeDB(
api_key=api_key,
index_name="test_index",
environment="test_env",

Loading…
Cancel
Save