Community : Modified doc strings and example notebook for Clarifai (#15816)

Community : Modified doc strings and example notebook for Clarifai

Description:
1. Modified doc strings inside clarifai vectorstore class and
embeddings.
2. Modified notebook examples.

---------

Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This commit is contained in:
mogith-pn 2024-01-11 09:03:10 +05:30 committed by GitHub
parent 97411e998f
commit 9e1ed17bfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 18 deletions

View File

@ -127,10 +127,8 @@
"Setup the user id and app id where the model resides. You can find a list of public models on https://clarifai.com/explore/models\n", "Setup the user id and app id where the model resides. You can find a list of public models on https://clarifai.com/explore/models\n",
"\n", "\n",
"You will have to also initialize the model id and if needed, the model version id. Some models have many versions, you can choose the one appropriate for your task.\n", "You will have to also initialize the model id and if needed, the model version id. Some models have many versions, you can choose the one appropriate for your task.\n",
"\n", " \n",
" or\n", "Alternatively, You can use the model_url (for ex: \"https://clarifai.com/anthropic/completion/models/claude-v2\") for intialization."
" \n",
"You can use the model_url (for ex: \"https://clarifai.com/anthropic/completion/models/claude-v2\") for intialization."
] ]
}, },
{ {

View File

@ -50,20 +50,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": null,
"id": "3f5dc9d7-65e3-4b5b-9086-3327d016cfe0", "id": "3f5dc9d7-65e3-4b5b-9086-3327d016cfe0",
"metadata": { "metadata": {
"tags": [] "tags": []
}, },
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
" ········\n"
]
}
],
"source": [ "source": [
"# Please login and get your API key from https://clarifai.com/settings/security\n", "# Please login and get your API key from https://clarifai.com/settings/security\n",
"from getpass import getpass\n", "from getpass import getpass\n",

View File

@ -23,7 +23,8 @@ class ClarifaiEmbeddings(BaseModel, Embeddings):
app_id=APP_ID, app_id=APP_ID,
model_id=MODEL_ID) model_id=MODEL_ID)
(or) (or)
clarifai_llm = Clarifai(model_url=EXAMPLE_URL) Example_URL = "https://clarifai.com/clarifai/main/models/BAAI-bge-base-en-v15"
clarifai = ClarifaiEmbeddings(model_url=EXAMPLE_URL)
""" """
model_url: Optional[str] = None model_url: Optional[str] = None

View File

@ -24,10 +24,12 @@ class Clarifai(VectorStore):
.. code-block:: python .. code-block:: python
from langchain_community.vectorstores import Clarifai from langchain_community.vectorstores import Clarifai
from langchain_community.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings() clarifai_vector_db = Clarifai(
vectorstore = Clarifai("langchain_store", embeddings.embed_query) user_id=USER_ID,
app_id=APP_ID,
number_of_docs=NUMBER_OF_DOCS,
)
""" """
def __init__( def __init__(