├── .github ├── PULL_REQUEST_TEMPLATE.md └── Weaviate.png ├── .gitignore ├── README.md ├── datasets ├── 1k_products.csv └── 1k_websites.csv ├── integrations ├── Weaviate-Import-Example.ipynb ├── cloud-hyperscalers │ ├── aws │ │ └── RAG_Cohere_Weaviate_v4_client.ipynb │ ├── azure │ │ └── azure-function-calling.ipynb │ ├── google │ │ ├── agents │ │ │ ├── gemini-api-query-agent.ipynb │ │ │ └── vertex-ai-query-agent.ipynb │ │ ├── bigquery │ │ │ ├── BigQuery-Weaviate-DSPy-RAG.ipynb │ │ │ ├── bigquery-images │ │ │ │ ├── Gemini.png │ │ │ │ ├── RAGwithContextFusion.png │ │ │ │ ├── bigquery.png │ │ │ │ ├── dspy.png │ │ │ │ ├── gcp-pod.png │ │ │ │ └── weaviate-logo.png │ │ │ └── readme.md │ │ └── gemini │ │ │ ├── gemini-ultra │ │ │ ├── README.md │ │ │ ├── cover_photo1.png │ │ │ ├── cover_photo2.png │ │ │ ├── docker-compose.yml │ │ │ ├── env.sample │ │ │ ├── gemini-ultra-weaviate.ipynb │ │ │ └── requirements.txt │ │ │ └── multimodal-and-gemini-flash │ │ │ └── NY-Roadshow-Gemini.ipynb │ └── nvidia │ │ ├── RAPIDS │ │ ├── CAGRA-cuVS.ipynb │ │ ├── cuVS-Modal.py │ │ ├── readme.md │ │ └── vector-search-on-gpus.md │ │ ├── agents │ │ └── nvidia-query-agent-tool.ipynb │ │ └── readme.md ├── compute-infrastructure │ ├── modal │ │ ├── Modal-cuVS.py │ │ ├── download_llama.py │ │ ├── modal_vllm_query.py │ │ ├── modal_web_server.py │ │ ├── readme.md │ │ └── vllm_outlines_setup.py │ └── replicate-llama2 │ │ ├── data │ │ ├── _core-1-28.mdx │ │ ├── ref2vec-centroid.mdx │ │ └── weaviate-1-16-release.mdx │ │ └── notebook.ipynb ├── data-platforms │ ├── airbyte │ │ └── README.md │ ├── aryn │ │ └── weaviate_blog_post.ipynb │ ├── astronomer │ │ └── README.md │ ├── box │ │ ├── LICENSE │ │ ├── README.md │ │ ├── demo_files │ │ │ ├── aapl_2023.pdf │ │ │ ├── aapl_2024.pdf │ │ │ ├── google_2023.pdf │ │ │ └── google_2024.pdf │ │ ├── images │ │ │ └── boxdev.png │ │ └── weaviate_box.ipynb │ ├── confluent-cloud │ │ └── README.md │ ├── context-data │ │ ├── README.md │ │ ├── VectorETL.ipynb │ │ ├── config.yaml │ │ ├── customers-100.csv │ │ └── examples │ │ │ ├── gcs-to-weaviate-using-cohere.yaml │ │ │ ├── postgres-to-weaviate.yaml │ │ │ └── s3-to-weaviate.yaml │ ├── databricks │ │ └── databricks-spark-connector.ipynb │ ├── huggingface │ │ ├── images │ │ │ └── huggingface-datasets.png │ │ └── weaviate-collection-to-hf-dataset-hub.ipynb │ ├── ibm │ │ └── docling │ │ │ └── rag_over_pdfs_docling_weaviate.ipynb │ ├── spark │ │ ├── spark-connector.ipynb │ │ └── tiny_Jeopardy.json │ ├── unstructured │ │ └── unstructured_weaviate.ipynb │ └── web-search │ │ └── firecrawl │ │ ├── firecrawl-to-weaviate.ipynb │ │ └── readme.md ├── llm-agent-frameworks │ ├── agentic-rag-benchmark │ │ └── vanilla-rag-vs-agentic-rag.ipynb │ ├── agno │ │ └── agno-weaviate-query-agent.ipynb │ ├── crewai │ │ └── crewai-query-agent-as-tool.ipynb │ ├── data │ │ ├── 2022-10-18-how-to-build-an-image-search-application-with-weaviate │ │ │ └── index.mdx │ │ ├── 2022-10-25-lock-striping-pattern │ │ │ └── index.mdx │ │ ├── 2022-11-01-weaviate-1-16-release │ │ │ ├── _core-1-16-include.mdx │ │ │ └── index.mdx │ │ ├── 2022-11-15-tutorial-backup-and-restore-in-weaviate │ │ │ └── index.mdx │ │ ├── 2022-11-23-ref2vec-centroid │ │ │ └── index.mdx │ │ ├── 2022-12-01-vector-library-vs-vector-database │ │ │ └── index.mdx │ │ ├── 2022-12-06-sphere-dataset-in-weaviate │ │ │ └── index.mdx │ │ ├── 2022-12-12-cohere-multilingual-with-weaviate │ │ │ └── index.mdx │ │ ├── 2022-12-20-weaviate-1-17-release │ │ │ ├── _core-1-17-include.mdx │ │ │ └── index.mdx │ │ ├── 2022-12-27-details-behind-the-sphere-dataset-in-weaviate │ │ │ └── index.mdx │ │ ├── 2023-01-03-hybrid-search-explained │ │ │ └── index.mdx │ │ ├── 2023-01-10-pulling-back-the-curtains-on-text2vec │ │ │ └── index.mdx │ │ ├── 2023-01-16-vector-embeddings-explained │ │ │ └── index.mdx │ │ ├── 2023-01-24-how-ai-creates-art │ │ │ └── index.mdx │ │ ├── 2023-01-31-weaviate-podcast-search │ │ │ └── index.mdx │ │ ├── 2023-02-07-generative-search │ │ │ └── index.mdx │ │ ├── 2023-02-14-what-to-expect-from-weaviate-in-2023 │ │ │ └── index.mdx │ │ ├── 2023-02-21-combining-langchain-and-weaviate │ │ │ └── index.mdx │ │ ├── 2023-02-28-solution-to-tl-drs │ │ │ └── index.mdx │ │ ├── 2023-03-07-weaviate-1-18-release │ │ │ ├── _core-1-18-include.mdx │ │ │ └── index.mdx │ │ ├── 2023-03-14-ann-algorithms-hnsw-pq │ │ │ └── index.mdx │ │ ├── 2023-03-21-ann-algorithms-tiles-encoder │ │ │ └── index.mdx │ │ ├── 2023-03-23-what-are-llms │ │ │ └── index.mdx │ │ ├── 2023-03-28-monitoring-weaviate-in-production │ │ │ └── index.mdx │ │ ├── 2023-04-04-weaviate-retrieval-plugin │ │ │ └── index.mdx │ │ ├── 2023-04-11-ranking-models │ │ │ └── index.mdx │ │ ├── 2023-04-18-autogpt-and-weaviate │ │ │ └── index.mdx │ │ ├── 2023-04-25-auth-in-weaviate │ │ │ └── index.mdx │ │ ├── 2023-04-27-how-to-chatgpt-plugin │ │ │ └── index.mdx │ │ ├── 2023-05-02-wcs-public-beta │ │ │ └── index.mdx │ │ ├── 2023-05-04-weaviate-1-19-release │ │ │ ├── _core-1-19-include.mdx │ │ │ └── index.mdx │ │ ├── 2023-05-05-generative-feedback-loops │ │ │ └── index.mdx │ │ ├── 2023-05-10-announcing-palm-modules │ │ │ └── index.mdx │ │ ├── 2023-05-23-pdfs-to-weaviate │ │ │ └── index.mdx │ │ ├── 2023-05-30-private-LLM │ │ │ └── index.mdx │ │ ├── 2023-06-06-embedded-weaviate │ │ │ └── index.mdx │ │ ├── 2023-06-13-llms-and-search │ │ │ └── index.mdx │ │ ├── 2023-06-15-multi-tenancy │ │ │ └── index.mdx │ │ ├── 2023-06-22-llamaindex-and-weaviate │ │ │ └── index.mdx │ │ ├── 2023-06-27-multimodal-models │ │ │ └── index.mdx │ │ ├── 2023-07-11-weaviate-1-20-release │ │ │ ├── _core-1-20-include.mdx │ │ │ └── index.mdx │ │ ├── 2023-07-18-automated-testing │ │ │ └── index.mdx │ │ ├── 2023-07-26-healthsearch-blogpost │ │ │ └── index.mdx │ │ ├── 2023-08-01-vector-database │ │ │ └── index.mdx │ │ ├── 2023-08-15-distance-metrics-in-vector-search │ │ │ └── index.mdx │ │ ├── 2023-08-22-weaviate-1-21-release │ │ │ ├── _core-1-21-include.mdx │ │ │ └── index.mdx │ │ ├── 2023-08-29-hybrid-search-fusion │ │ │ └── index.mdx │ │ ├── 2023-09-11-weaviate-gorilla-part-1 │ │ │ └── index.mdx │ │ ├── 2023-09-19-pq-rescoring │ │ │ └── index.mdx │ │ ├── 2023-09-26-collections-python-client │ │ │ └── index.mdx │ │ ├── 2023-09-26-confluent-and-weaviate │ │ │ └── index.mdx │ │ ├── 2023-10-02-hacktoberfest-2023 │ │ │ └── index.mdx │ │ ├── 2023-10-31-weaviate-1-22-release │ │ │ ├── _core-1-22-include.mdx │ │ │ └── index.mdx │ │ ├── 2023-11-15-moonsift-story │ │ │ └── index.mdx │ │ ├── 2023-11-21-rag-evaluation │ │ │ └── index.mdx │ │ ├── 2023-11-30-zero-downtime-upgrades │ │ │ └── index.mdx │ │ ├── 2023-12-05-multimodal-RAG │ │ │ └── index.mdx │ │ ├── 2023-12-12-aws-reinvent │ │ │ └── index.mdx │ │ ├── 2023-12-19-weaviate-1-23-release │ │ │ ├── _core-1-23-include.mdx │ │ │ └── index.mdx │ │ ├── 2023-12-26-weaviate-recap │ │ │ └── index.mdx │ │ └── 2024-01-23-typescript-multimodal-search │ │ │ └── index.mdx │ ├── dspy │ │ ├── 1.Getting-Started-with-RAG-in-DSPy.ipynb │ │ ├── 2.Writing-Blog-Posts-with-DSPy.ipynb │ │ ├── 3.Adding-Depth-to-RAG-Programs.ipynb │ │ ├── 4.Structured-Outputs-with-DSPy.ipynb │ │ ├── 5.Advanced-Optimizers.ipynb │ │ ├── Meta-Agent-Generation.ipynb │ │ ├── Query-Agent-as-a-Tool.ipynb │ │ ├── WeaviateBlogRAG-0-0-0.json │ │ ├── archived-issues │ │ │ ├── Dialogue-Classifier.ipynb │ │ │ └── readme.md │ │ ├── community.md │ │ ├── docker-compose.yml │ │ ├── dspy-and-you │ │ │ ├── Web-Research-Agent-with-Weaviate-and-You.ipynb │ │ │ └── readme.md │ │ ├── dspy_local_setup.md │ │ ├── faq.md │ │ ├── fullstack-recipes │ │ │ ├── RAGwithPersona │ │ │ │ ├── 4.RAG-with-Persona.ipynb │ │ │ │ ├── Create-Weaviate-Schema.ipynb │ │ │ │ ├── Readme.md │ │ │ │ ├── backend.py │ │ │ │ ├── docker-compose.yml │ │ │ │ └── rag-with-persona │ │ │ │ │ ├── package-lock.json │ │ │ │ │ ├── package.json │ │ │ │ │ ├── public │ │ │ │ │ ├── favicon.ico │ │ │ │ │ ├── index.html │ │ │ │ │ ├── logo192.png │ │ │ │ │ ├── logo512.png │ │ │ │ │ ├── manifest.json │ │ │ │ │ ├── readme.md │ │ │ │ │ └── robots.txt │ │ │ │ │ ├── readme.md │ │ │ │ │ └── src │ │ │ │ │ ├── App.css │ │ │ │ │ ├── App.js │ │ │ │ │ ├── App.test.js │ │ │ │ │ ├── assets │ │ │ │ │ ├── bg-light-3.png │ │ │ │ │ └── readme.md │ │ │ │ │ ├── index.css │ │ │ │ │ ├── index.js │ │ │ │ │ ├── logo.svg │ │ │ │ │ ├── readme.md │ │ │ │ │ ├── reportWebVitals.js │ │ │ │ │ └── setupTests.js │ │ │ └── readme.md │ │ ├── llms │ │ │ ├── Command-R-Plus.ipynb │ │ │ ├── Gemini-1.5-Pro-and-Flash.ipynb │ │ │ ├── Llama3.ipynb │ │ │ ├── Readme.md │ │ │ └── images │ │ │ │ └── many-shot.png │ │ ├── readme.md │ │ └── recipes │ │ │ ├── RAGwithMultiAgentDebate.ipynb │ │ │ ├── metrics │ │ │ └── TypedEvaluator.py │ │ │ └── readme.md │ ├── dynamiq │ │ ├── dynamiq-getting-started.ipynb │ │ └── dynamiq-research-workflow.ipynb │ ├── function-calling │ │ ├── anthropic │ │ │ └── weaviate-query-agent-tool.ipynb │ │ ├── azure-openai │ │ │ └── azure-function-calling.ipynb │ │ ├── baseten │ │ │ └── baseten-query-agent.ipynb │ │ ├── cohere │ │ │ └── cohere-query-agent-tool.ipynb │ │ ├── composio │ │ │ ├── Generative_artificial_intelligence.pdf │ │ │ ├── agent.ipynb │ │ │ └── readme.md │ │ ├── google-ai-studio │ │ │ └── gemini-api-query-agent.ipynb │ │ ├── google-vertex-ai │ │ │ └── vertex-ai-query-agent.ipynb │ │ ├── hugging-face-smolagents │ │ │ └── smolagents-query-tool.ipynb │ │ ├── nvidia │ │ │ └── nvidia-query-agent-tool.ipynb │ │ ├── ollama │ │ │ ├── Where-Filter-Function-Calling.ipynb │ │ │ ├── multi-index-ollama-and-weaviate.ipynb │ │ │ ├── ollama-query-agent-tool.ipynb │ │ │ ├── ollama-simple-tool-call.ipynb │ │ │ └── readme.md │ │ ├── openai │ │ │ └── openai-swarm.ipynb │ │ └── together-ai │ │ │ └── together-ai-query-agent.ipynb │ ├── haystack │ │ ├── haystack-query-agent-tool.ipynb │ │ └── query_expansion_haystack_weaviate.ipynb │ ├── langchain │ │ ├── LCEL │ │ │ ├── RAG-with-LangChain-LCEL-and-DSPy.ipynb │ │ │ └── readme.md │ │ ├── agents │ │ │ └── langchain-weaviate-query-agent.ipynb │ │ ├── example-selector-similarity │ │ │ └── example.ipynb │ │ └── loading-data │ │ │ ├── brazil-wikipedia-article-text.pdf │ │ │ ├── docker-compose.yml │ │ │ ├── langchain-simple-pdf-multitenant.ipynb │ │ │ ├── langchain-simple-pdf.ipynb │ │ │ └── netherlands-wikipedia-article-text.pdf │ ├── letta │ │ ├── architectural-visual.png │ │ ├── letta-create-agent.png │ │ ├── letta-demo.ipynb │ │ ├── letta-tools.png │ │ ├── letta-update-tools.png │ │ └── readme.md │ ├── llamaindex │ │ ├── agents │ │ │ ├── agent-workflow-with-weaviate-query-agent-.ipynb │ │ │ └── llama-index-weaviate-assistant-agent.ipynb │ │ ├── data-loaders-episode1 │ │ │ ├── data │ │ │ │ ├── ref2vec-centroid.mdx │ │ │ │ └── weaviate-1-16-release.mdx │ │ │ └── episode1.ipynb │ │ ├── indexes-episode2 │ │ │ ├── data │ │ │ │ ├── multi-tenancy.mdx │ │ │ │ └── weaviate-1-20-release.mdx │ │ │ ├── indexes-in-llamaindex.ipynb │ │ │ └── meeting-notes │ │ │ │ └── meeting-notes.mdx │ │ ├── recursive-query-engine │ │ │ └── recursive-retrieval.ipynb │ │ ├── retrieval-augmented-generation │ │ │ ├── advanced_rag.ipynb │ │ │ └── naive_rag.ipynb │ │ ├── self-correcting-query-engine │ │ │ ├── data │ │ │ │ └── weaviate-1-16-release.mdx │ │ │ └── self-correcting.ipynb │ │ ├── simple-query-engine │ │ │ └── simple-query-engine.ipynb │ │ ├── sql-router-query-engine │ │ │ └── sql-query-router.ipynb │ │ └── sub-question-query-engine │ │ │ └── sub_question_query_engine.ipynb │ ├── pydantic │ │ ├── logfire-weaviate.ipynb │ │ ├── pydantic-logfire.png │ │ └── pydantic-weaviate-query-tool.ipynb │ ├── readme.md │ └── semantic-kernel │ │ ├── Chatbot_RAG_Weaviate.ipynb │ │ ├── RetrievalAugmentedGeneration_Weaviate.ipynb │ │ ├── dotnet │ │ ├── Chatbot_RAG_Weaviate.ipynb │ │ ├── RetrievalAugmentedGeneration_Weaviate (1).ipynb │ │ └── weaviate-persistent-memory.ipynb │ │ └── weaviate-persistent-memory.ipynb └── operations │ ├── aimon │ └── reranking_and_evaluation.ipynb │ ├── arize │ └── DSPy-Instrumentor.py │ ├── cleanlab │ └── rag_with_weaviate_and_cleanlab.ipynb │ ├── comet │ └── Opik-Tracing-and-Evals.ipynb │ ├── deepeval │ └── rag_evaluation_deepeval.ipynb │ ├── langtrace │ └── weaviate_observability.ipynb │ ├── langwatch │ ├── docker-compose.yml │ ├── optimization_screenshot.png │ ├── tracing_screenshot.png │ └── weaviate_dspy_visualization.ipynb │ ├── nomic │ └── vector_space_visual.ipynb │ ├── patronus │ ├── images │ │ ├── patronus-gui.png │ │ ├── patronus-logo.png │ │ ├── percival-1.png │ │ └── percival-2.png │ ├── lynx-query-agent.ipynb │ └── percival-demo.ipynb │ ├── ragas │ ├── RAGAs-RAG-langchain.ipynb │ ├── faq.json │ └── ragas-demo.ipynb │ ├── trulens │ ├── images │ │ ├── trulens_weaviate_identify_issues.gif │ │ └── trulens_weaviate_validate.gif │ └── query-agent-evaluation-with-trulens.ipynb │ └── weights_and_biases │ ├── RAG-optimization-dashboard.png │ ├── readme.md │ └── wandb_logging_RAG_dspy_cohere.ipynb ├── weaviate-features ├── _docker │ ├── docker-compose-apis.yml │ ├── docker-compose-contextionary.yml │ └── docker-compose-transformers.yml ├── backup │ └── simple-filesystem-backup.ipynb ├── batch │ └── ingest-retry │ │ ├── Amazon_Meta_CDs_Vinyl_00.json │ │ ├── README.md │ │ ├── batch_import_products.py │ │ ├── docker-compose.yml │ │ ├── ingest_with_retry.ipynb │ │ └── requirements.txt ├── bring-your-own-vectors-and-multi-lingual │ ├── modernBERT_embeddings │ │ ├── vector_search_modernbert.ipynb │ │ └── vector_search_modernbert_cover_image.png │ ├── vector_search.ipynb │ └── vector_search_japanese.ipynb ├── classification │ ├── knn │ │ ├── add_data.py │ │ └── compose.yml │ └── zeroshot │ │ ├── add_data.py │ │ ├── classification-zero-shot.ipynb │ │ └── compose.yml ├── evaluation │ ├── evaluation_metrics_information_retrieval.ipynb │ ├── how_to_choose_an_embedding_model.ipynb │ └── pastry_data.csv ├── filters │ ├── filter_contains_all.ipynb │ └── filter_none.ipynb ├── generative-search │ ├── data │ │ ├── 2022-11-01-weaviate-1-16-release.mdx │ │ ├── 2022-11-23-ref2vec-centroid.mdx │ │ ├── 2023-05-05-generative-feedback-loops.mdx │ │ └── 2023-06-15-multi-tenancy.mdx │ ├── from_dspy │ │ ├── generative_search_cohere_dspy_optimized.ipynb │ │ └── readme.md │ ├── generative_search_anthropic │ │ ├── generative_search_anthropic.ipynb │ │ └── rag_with_anthropic_citations.ipynb │ ├── generative_search_aws.ipynb │ ├── generative_search_aws_bedrock.ipynb │ ├── generative_search_cohere.ipynb │ ├── generative_search_databricks.ipynb │ ├── generative_search_friendliai.ipynb │ ├── generative_search_mistral.ipynb │ ├── generative_search_nvidia.ipynb │ ├── generative_search_ollama │ │ ├── deepseek-ollama-epic-games-rag.ipynb │ │ ├── local_rag_using_ollama_integration_using_embedded.ipynb │ │ └── ollama_local_rag.ipynb │ ├── generative_search_openai.ipynb │ ├── generative_search_palm.ipynb │ └── generative_search_xai.ipynb ├── hybrid-search │ ├── hybrid_search_aws.ipynb │ ├── hybrid_search_aws_bedrock.ipynb │ ├── hybrid_search_azure_openai.ipynb │ ├── hybrid_search_cohere.ipynb │ ├── hybrid_search_cohere_japanese.ipynb │ ├── hybrid_search_contextionary.ipynb │ ├── hybrid_search_databricks.ipynb │ ├── hybrid_search_google.ipynb │ ├── hybrid_search_huggingface.ipynb │ ├── hybrid_search_mistral.ipynb │ ├── hybrid_search_nvidia.ipynb │ ├── hybrid_search_openai.ipynb │ ├── hybrid_search_transformers.ipynb │ └── snowflake-embed │ │ ├── docker-compose-t2v-snowflake.yml │ │ └── hybrid_search_snowflake.ipynb ├── media-search │ ├── docker-compose-clip.yaml │ ├── docker-compose.yml │ ├── image_search_clip.ipynb │ ├── image_search_voyageai.ipynb │ ├── media_search_bind.ipynb │ ├── source │ │ ├── audio │ │ │ ├── mixkit-big-thunder-with-rain-1291.wav │ │ │ ├── mixkit-cartoon-kitty-begging-meow-92.wav │ │ │ ├── mixkit-cow-moo-1744.wav │ │ │ ├── mixkit-crowd-laugh-424.wav │ │ │ ├── mixkit-dog-barking-twice-1.wav │ │ │ ├── mixkit-jungle-ape-sound-2419.wav │ │ │ ├── mixkit-little-birds-singing-in-the-trees-17.wav │ │ │ ├── mixkit-rain-and-thunder-storm-2390.wav │ │ │ ├── mixkit-rooster-crowing-in-the-morning-2462.wav │ │ │ ├── mixkit-sick-man-sneeze-2213.wav │ │ │ └── mixkit-small-group-cheer-and-applause-518.wav │ │ ├── image │ │ │ ├── cat1.jpg │ │ │ ├── cat2.jpg │ │ │ ├── cat3.jpg │ │ │ ├── dog1.jpg │ │ │ ├── dog2.jpg │ │ │ ├── dog3.jpg │ │ │ ├── meerkat1.jpg │ │ │ ├── meerkat2.jpg │ │ │ └── meerkat3.jpg │ │ └── video │ │ │ ├── cat-clean.mp4 │ │ │ ├── cat-play.mp4 │ │ │ ├── dog-high-five.mp4 │ │ │ ├── dog-with-stick.mp4 │ │ │ ├── meerkat-dig.mp4 │ │ │ └── meerkat-watch.mp4 │ ├── test │ │ ├── bird_audio.wav │ │ ├── dog_audio.wav │ │ ├── test-cat.jpg │ │ ├── test-cat.mp4 │ │ ├── test-dog.jpg │ │ ├── test-dog.mp4 │ │ ├── test-meerkat.jpg │ │ └── test-meerkat.mp4 │ └── todo.md ├── multi-tenancy │ ├── multi-tenancy-automatic-tenant-creation.ipynb │ ├── multi-tenancy-example.ipynb │ └── multi-tenant-academy-course.ipynb ├── multi-vector │ ├── ColPali-POC.ipynb │ ├── NamedVectors-ColPali-POC.ipynb │ ├── Pipfile │ ├── figures │ │ ├── colipali_pipeline.jpeg │ │ └── deepseek_efficiency.jpeg │ ├── modern-colbert.ipynb │ ├── multi-vector-colipali-rag.ipynb │ └── reason_moderncolbert.ipynb ├── quantization │ ├── ScalarQuantizationExample.ipynb │ ├── product-quantization │ │ ├── PQ_compression_cohere.ipynb │ │ ├── PQ_compression_openai.ipynb │ │ └── docker-compose.yml │ └── readme.md ├── reranking │ ├── cohere-ranking │ │ ├── finetune-reranker │ │ │ ├── azure_openai_usage.log │ │ │ ├── blog │ │ │ │ ├── 2022-11-01-weaviate-1-16-release.mdx │ │ │ │ ├── 2022-11-23-ref2vec-centroid.mdx │ │ │ │ ├── 2023-02-07-generative-search.mdx │ │ │ │ ├── 2023-05-05-generative-feedback-loops.mdx │ │ │ │ └── 2023-06-15-multi-tenancy.mdx │ │ │ ├── cohere-dashboard.png │ │ │ ├── data.jsonl │ │ │ ├── demo.ipynb │ │ │ ├── train.jsonl │ │ │ └── validation.jsonl │ │ └── simple-reranking │ │ │ ├── cohere-ranking.ipynb │ │ │ ├── ranking-models.mdx │ │ │ └── ref2vec-centroid.mdx │ ├── openai-ranking │ │ ├── faq.json │ │ ├── listwise-ranking-openai.ipynb │ │ └── listwise.jpeg │ ├── todo.md │ └── voyageai-ranking │ │ └── simple-reranking │ │ ├── ranking-models.mdx │ │ ├── ref2vec-centroid.mdx │ │ └── voyageai-ranking.ipynb ├── services-research │ ├── berlin.txt │ ├── contextual_document_embeddings.ipynb │ ├── contextual_retrieval.ipynb │ ├── late_chunking.ipynb │ └── late_chunking_berlin.ipynb └── similarity-search │ ├── similarity_search_aws.ipynb │ ├── similarity_search_aws_bedrock.ipynb │ ├── similarity_search_azure_openai.ipynb │ ├── similarity_search_cohere.ipynb │ ├── similarity_search_contextionary.ipynb │ ├── similarity_search_databricks.ipynb │ ├── similarity_search_huggingface.ipynb │ ├── similarity_search_mistral.ipynb │ ├── similarity_search_nvidia.ipynb │ ├── similarity_search_openai.ipynb │ ├── similarity_search_palm.ipynb │ ├── similarity_search_transformers.ipynb │ ├── similarity_search_voyageai.ipynb │ └── snowflake-embed │ ├── docker-compose-t2v-snowflake.yml │ └── similarity_search_transformers.ipynb └── weaviate-services ├── agents ├── README.md ├── images │ ├── pod-110-thumbnail.png │ └── synthetic-query-overview-new.png ├── personalization-agent-get-started-movies.ipynb ├── personalization-agent-get-started-recipes.ipynb ├── query-agent-get-started.ipynb ├── transformation-agent-get-started.ipynb ├── transformation-agent-retrieval-benchmark.ipynb └── transformation-agent-sleep-time-compute.ipynb └── embedding-service └── weaviate_embeddings_service.ipynb /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 10 | 11 | ## Description 12 | 13 | 14 | ## Contribution Type 15 | - [ ] Integration 16 | - [ ] Weaviate feature 17 | - [ ] Weaviate service 18 | 19 | ## Promotion 20 | 21 | - Personal X handle (optional): 22 | - Personal LinkedIn account (optional): 23 | - Company X handle: 24 | - Company LinkedIn account: 25 | -------------------------------------------------------------------------------- /.github/Weaviate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/.github/Weaviate.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to Weaviate Recipes 💚 2 | 3 | ![Weaviate logo](.github/Weaviate.png) 4 | 5 | This repository covers end-to-end examples of the various features and integrations with [Weaviate](https://www.weaviate.io). 6 | 7 | | Category | Description | 8 | | -------------|---------| 9 | | [Datasets](/datasets/) | Ready to use datasets to ingest data into your Weaviate cluster | 10 | | [Integrations](/integrations)| Notebooks showing you how to use Weaviate plus another technology | 11 | | [Weaviate Features](/weaviate-features) | Notebooks covering vector, hybrid and generative search, reranking, multi-tenancy, and more | 12 | | [Weaviate Services](/weaviate-services/) | Notebooks showing you how to build with Weaviate Services | 13 | 14 | 15 | ## Integrations 🌐 16 | Check out Weaviate's [Integrations Documentation](https://weaviate.io/developers/integrations)! 17 | 18 | | Company Category | Companies | 19 | |------------------|-----------| 20 | | Cloud Hyperscalers | Google, AWS, NVIDIA | 21 | | Compute Infrastructure | Modal, Replicate | 22 | | LLM and Agent Frameworks | Agno, CrewAI, Composio, DSPy, Dynamiq, LangChain, LlamaIndex, Pydantic, Semantic Kernel, Ollama, Haystack | 23 | | Data Platforms| Databricks, Confluent, Box, Boomi, Spark, Unstructured, Firecrawl, Context Data, Aryn, Astronomer, Airbyte, IBM (Docling) | 24 | | Operations | AIMon, Arize, Cleanlab, Comet, DeepEval, Langtrace, LangWatch, Nomic, Patronus AI, Ragas, TruLens, Weights & Biases | 25 | 26 | 27 | ## Weaviate Features 🔧 28 | 29 | | Feature | Description | 30 | |---------|-------------| 31 | | Similarity Search | Use Weaviate's `nearText` operator to run semantic search queries (broken out by model provider) | 32 | | Hybrid Search | Use Weaviate's `hybrid` operator to run hybrid search queries (broken out by model provider) | 33 | | Generative Search | Build a simple RAG workflow using Weaviate's `.generate` (broken out by model provider) | 34 | | Filters | Narrow down your search results by adding filters to your queries | 35 | | Reranking | Add reranking to your pipeline to improve search results (broken out by model provider) | 36 | | Media Search | Use Weaviate's `nearImage` and `nearVideo` operator to search using images and videos | 37 | | Classification | Learn how to use KNN and zero-shot classification | 38 | | Multi-Tenancy | Store tenants on separate shards for complete data isolation | 39 | | Multi-Vector Embeddings | Use Weaviate with powerful ColBERT-style embeddings to improve search results | 40 | | Product Quantization | Compress vector embeddings and reduce the memory footprint using Weaviate's PQ feature | 41 | | Evaluation | Evaluate your search system | 42 | 43 | ## Weaviate Services 🧰 44 | | Service | Description | 45 | |---------|-------------| 46 | | Agents | Use Weaviate's inherent agents like the `QueryAgent` & `TransformationAgent` | 47 | | Weaviate Embeddings | [Weaviate Embeddings](https://weaviate.io/developers/wcs/embeddings) enables you to generate embeddings directly from a [Weaviate Cloud](https://console.weaviate.cloud/) database instance. | 48 | 49 | ## Feedback ❓ 50 | Please note this is an ongoing project, and updates will be made frequently. If you have a feature you would like to see, please create a GitHub issue or feel free to contribute one yourself! 51 | -------------------------------------------------------------------------------- /integrations/Weaviate-Import-Example.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "28af9f4c", 6 | "metadata": {}, 7 | "source": [ 8 | "# Weaviate Import\n", 9 | "\n", 10 | "This notebook is used to populate the `WeaviateBlogChunk` collection.\n", 11 | "\n", 12 | "You can connect to Weaviate through local host, or create a free 14-day sandbox on [WCD](https://console.weaviate.cloud/)!\n", 13 | "\n", 14 | "1. Create a cluster on WCD and grab your cluster URL and auth key (if enabled)\n", 15 | "\n", 16 | "2. We're using the Weaviate Embeddings to vectorize our data. Please note it is only available through WCD at the moment. For other model options, refer [here](https://weaviate.io/developers/weaviate/model-providers).\n", 17 | "\n", 18 | "3. Make sure the `llm-frameworks/data` folder is accessible\n", 19 | "\n", 20 | "4. Run this notebook and the 1182 blog chunks will be loaded into your Weaviate instance." 21 | ] 22 | }, 23 | { 24 | "cell_type": "markdown", 25 | "id": "db1c926e", 26 | "metadata": {}, 27 | "source": [ 28 | "## Connect to Client" 29 | ] 30 | }, 31 | { 32 | "cell_type": "code", 33 | "execution_count": 1, 34 | "id": "3e2b7bbf", 35 | "metadata": {}, 36 | "outputs": [], 37 | "source": [ 38 | "import weaviate\n", 39 | "import os\n", 40 | "from weaviate.classes.init import Auth\n", 41 | "import weaviate.classes.config as wvcc\n", 42 | "import re\n", 43 | "from weaviate.util import get_valid_uuid\n", 44 | "from uuid import uuid4" 45 | ] 46 | }, 47 | { 48 | "cell_type": "code", 49 | "execution_count": null, 50 | "id": "cf69ba40", 51 | "metadata": {}, 52 | "outputs": [], 53 | "source": [ 54 | "# Connect to the client\n", 55 | "\n", 56 | "WCD_CLUSTER_URL = os.getenv(\"WCD_CLUSTER_URL\")\n", 57 | "WCD_CLUSTER_KEY = os.getenv(\"WCD_CLUSTER_KEY\")\n", 58 | "\n", 59 | "client = weaviate.connect_to_weaviate_cloud(\n", 60 | " cluster_url=WCD_CLUSTER_URL,\n", 61 | " auth_credentials=Auth.api_key(WCD_CLUSTER_KEY),\n", 62 | ")\n", 63 | "\n", 64 | "print(client.is_ready())" 65 | ] 66 | }, 67 | { 68 | "cell_type": "markdown", 69 | "id": "19bb10a5", 70 | "metadata": {}, 71 | "source": [ 72 | "## Create Schema" 73 | ] 74 | }, 75 | { 76 | "cell_type": "code", 77 | "execution_count": 13, 78 | "id": "8b209831", 79 | "metadata": {}, 80 | "outputs": [], 81 | "source": [ 82 | "# CAUTION: Running this will delete the collection along with the objects\n", 83 | "\n", 84 | "# client.collections.delete_all()" 85 | ] 86 | }, 87 | { 88 | "cell_type": "code", 89 | "execution_count": 10, 90 | "id": "f3643f23", 91 | "metadata": {}, 92 | "outputs": [], 93 | "source": [ 94 | "collection = client.collections.create(\n", 95 | " name=\"WeaviateBlogChunk\",\n", 96 | " vectorizer_config=wvcc.Configure.Vectorizer.text2vec_weaviate\n", 97 | " (\n", 98 | " model=\"Snowflake/snowflake-arctic-embed-l-v2.0\", # default model\n", 99 | " ),\n", 100 | " properties=[\n", 101 | " wvcc.Property(name=\"content\", data_type=wvcc.DataType.TEXT),\n", 102 | " wvcc.Property(name=\"author\", data_type=wvcc.DataType.TEXT),\n", 103 | " ]\n", 104 | ")" 105 | ] 106 | }, 107 | { 108 | "cell_type": "markdown", 109 | "id": "19336940", 110 | "metadata": {}, 111 | "source": [ 112 | "## Chunk Blogs" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": 5, 118 | "id": "9a6788d9", 119 | "metadata": {}, 120 | "outputs": [], 121 | "source": [ 122 | "def chunk_list(lst, chunk_size):\n", 123 | " \"\"\"Break a list into chunks of the specified size.\"\"\"\n", 124 | " return [lst[i:i + chunk_size] for i in range(0, len(lst), chunk_size)]\n", 125 | "\n", 126 | "def split_into_sentences(text):\n", 127 | " \"\"\"Split text into sentences using regular expressions.\"\"\"\n", 128 | " sentences = re.split(r'(? str:\n", 107 | " \"\"\"\n", 108 | " Send a query to the database and get the response.\n", 109 | "\n", 110 | " Args:\n", 111 | " query (str): The question or query to search for in the database. This can be any natural language question related to the content stored in the database.\n", 112 | "\n", 113 | " Returns:\n", 114 | " str: The response from the database containing relevant information.\n", 115 | " \"\"\"\n", 116 | "\n", 117 | " weaviate_client = weaviate.connect_to_weaviate_cloud(\n", 118 | " cluster_url=os.getenv(\"WEAVIATE_URL\"),\n", 119 | " auth_credentials=weaviate.auth.AuthApiKey(os.getenv(\"WEAVIATE_API_KEY\")),\n", 120 | " )\n", 121 | " \n", 122 | " query_agent = QueryAgent(\n", 123 | " client=weaviate_client,\n", 124 | " collections=[\"Blogs\"] # we are using the Weaviate Embeddings for our Blogs collection\n", 125 | " )\n", 126 | " return query_agent.run(query).final_answer" 127 | ] 128 | }, 129 | { 130 | "cell_type": "code", 131 | "execution_count": null, 132 | "metadata": {}, 133 | "outputs": [ 134 | { 135 | "name": "stdout", 136 | "output_type": "stream", 137 | "text": [ 138 | "To deploy Weaviate on Docker, you need Docker and Docker Compose CLI. Download a 'docker-compose.yml' file using Weaviate's configuration tool to customize it. Then, navigate to the directory containing the file and run `docker compose up -d` in the terminal. This will start the setup in detached mode. Ensure the file is correctly named and located before starting. Refer to the Weaviate documentation for more configuration options.\n", 139 | "\n" 140 | ] 141 | } 142 | ], 143 | "source": [ 144 | "prompt = \"\"\"\n", 145 | "You are connected to a database that has a blog post on deploying Weaviate on Docker. \n", 146 | "Can you answer how I can Weaviate with Docker? \n", 147 | "\"\"\"\n", 148 | "\n", 149 | "response = client.models.generate_content(\n", 150 | " model=MODEL_ID,\n", 151 | " contents=prompt,\n", 152 | " config=GenerateContentConfig(tools=[send_query_agent_request], temperature=0),\n", 153 | ")\n", 154 | "print(response.text)" 155 | ] 156 | } 157 | ], 158 | "metadata": { 159 | "kernelspec": { 160 | "display_name": "Python 3", 161 | "language": "python", 162 | "name": "python3" 163 | }, 164 | "language_info": { 165 | "codemirror_mode": { 166 | "name": "ipython", 167 | "version": 3 168 | }, 169 | "file_extension": ".py", 170 | "mimetype": "text/x-python", 171 | "name": "python", 172 | "nbconvert_exporter": "python", 173 | "pygments_lexer": "ipython3", 174 | "version": "3.11.6" 175 | } 176 | }, 177 | "nbformat": 4, 178 | "nbformat_minor": 2 179 | } 180 | -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/google/bigquery/bigquery-images/Gemini.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/cloud-hyperscalers/google/bigquery/bigquery-images/Gemini.png -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/google/bigquery/bigquery-images/RAGwithContextFusion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/cloud-hyperscalers/google/bigquery/bigquery-images/RAGwithContextFusion.png -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/google/bigquery/bigquery-images/bigquery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/cloud-hyperscalers/google/bigquery/bigquery-images/bigquery.png -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/google/bigquery/bigquery-images/dspy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/cloud-hyperscalers/google/bigquery/bigquery-images/dspy.png -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/google/bigquery/bigquery-images/gcp-pod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/cloud-hyperscalers/google/bigquery/bigquery-images/gcp-pod.png -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/google/bigquery/bigquery-images/weaviate-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/cloud-hyperscalers/google/bigquery/bigquery-images/weaviate-logo.png -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/google/bigquery/readme.md: -------------------------------------------------------------------------------- 1 | # BigQuery 2 | 3 | From https://www.cloud.google.com/bigquery, "BigQuery is a fully managed, AI-ready data analytics platform that helps you maximize value from your data and is designed to be multi-engine, multi-format, and multi-cloud". 4 | -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/google/gemini/gemini-ultra/README.md: -------------------------------------------------------------------------------- 1 | # Weaviate Vector Database with Google Gemini Ultra Quickstart Guide 2 | 3 | This repository contains a Jupyter Notebook that sets you up to use the Weaviate vector database with Google Gemini Ultra. 4 | 5 | ![cover image](cover_photo2.png) 6 | 7 | ## Prerequisites 8 | 9 | - Python 3.6 or higher 10 | - Weaviate Python client (V4) 11 | - Google Gemini Ultra Access 12 | - Weaviate running 1.24 with the Generative Palm 13 | 14 | ## Setup 15 | 16 | 1. Clone this repository to your local machine. 17 | 2. Install the necessary Python packages using pip: 18 | ```bash 19 | $ python3 -m venv venv 20 | $ source venv/bin/activate 21 | $ pip install -r requirements.txt 22 | $ jupyter notebook 23 | ``` 24 | 3. Get an API Key from [Google Maker Suite](https://makersuite.google.com) to make calls against Gemini Ultra. 25 | 4. Copy env.sample to .env and replace the API key and associate GCP project id into the .env file 26 | 27 | ## Usage 28 | 29 | Run the `jupyter notebook`, then open the notebok in a browser to interact with the Weaviate vector database using Google Gemini Ultra. Execute through each cell to try out a semantic search and a generative search or RAG example which leverages Google Gemini Ultra as the model. -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/google/gemini/gemini-ultra/cover_photo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/cloud-hyperscalers/google/gemini/gemini-ultra/cover_photo1.png -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/google/gemini/gemini-ultra/cover_photo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/cloud-hyperscalers/google/gemini/gemini-ultra/cover_photo2.png -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/google/gemini/gemini-ultra/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | services: 3 | weaviate: 4 | command: 5 | - --host 6 | - 0.0.0.0 7 | - --port 8 | - '8080' 9 | - --scheme 10 | - http 11 | image: semitechnologies/weaviate:preview-add-support-for-gemini-ultra-model-ea70be9 12 | ports: 13 | - 8080:8080 14 | - 50051:50051 15 | volumes: 16 | - weaviate_data:/var/lib/weaviate 17 | restart: on-failure:0 18 | environment: 19 | QUERY_DEFAULTS_LIMIT: 25 20 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 21 | PERSISTENCE_DATA_PATH: '/var/lib/weaviate' 22 | DEFAULT_VECTORIZER_MODULE: 'none' 23 | ENABLE_MODULES: 'text2vec-palm,generative-palm, text2vec-openai' 24 | CLUSTER_HOSTNAME: 'node1' 25 | volumes: 26 | weaviate_data: 27 | 28 | -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/google/gemini/gemini-ultra/env.sample: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY=INSERTKEY 2 | GEMINI_ULTRA_API_KEY=INSERTKEY 3 | GCP_PROJECT_ID=INSERTPROJECTID -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/google/gemini/gemini-ultra/requirements.txt: -------------------------------------------------------------------------------- 1 | annotated-types==0.6.0 2 | anyio==4.2.0 3 | appnope==0.1.3 4 | argon2-cffi==23.1.0 5 | argon2-cffi-bindings==21.2.0 6 | arrow==1.3.0 7 | asttokens==2.4.1 8 | async-lru==2.0.4 9 | attrs==23.2.0 10 | Authlib==1.3.0 11 | Babel==2.14.0 12 | beautifulsoup4==4.12.3 13 | bleach==6.1.0 14 | certifi==2024.2.2 15 | cffi==1.16.0 16 | charset-normalizer==3.3.2 17 | comm==0.2.1 18 | cryptography==42.0.2 19 | debugpy==1.8.0 20 | decorator==5.1.1 21 | defusedxml==0.7.1 22 | executing==2.0.1 23 | fastjsonschema==2.19.1 24 | fqdn==1.5.1 25 | googleapis-common-protos==1.62.0 26 | grpcio==1.60.1 27 | grpcio-health-checking==1.60.1 28 | grpcio-tools==1.60.1 29 | h11==0.14.0 30 | httpcore==1.0.2 31 | httplib2==0.22.0 32 | httpx==0.26.0 33 | idna==3.6 34 | ipykernel==6.29.1 35 | ipython==8.21.0 36 | ipywidgets==8.1.1 37 | isoduration==20.11.0 38 | jedi==0.19.1 39 | Jinja2==3.1.3 40 | json5==0.9.14 41 | jsonpointer==2.4 42 | jsonschema==4.21.1 43 | jsonschema-specifications==2023.12.1 44 | jupyter==1.0.0 45 | jupyter-console==6.6.3 46 | jupyter-events==0.9.0 47 | jupyter-lsp==2.2.2 48 | jupyter_client==8.6.0 49 | jupyter_core==5.7.1 50 | jupyter_server==2.12.5 51 | jupyter_server_terminals==0.5.2 52 | jupyterlab==4.1.0 53 | jupyterlab-widgets==3.0.9 54 | jupyterlab_pygments==0.3.0 55 | jupyterlab_server==2.25.2 56 | MarkupSafe==2.1.5 57 | matplotlib-inline==0.1.6 58 | mistune==3.0.2 59 | nbclient==0.9.0 60 | nbconvert==7.15.0 61 | nbformat==5.9.2 62 | nest-asyncio==1.6.0 63 | notebook==7.0.7 64 | notebook_shim==0.2.3 65 | oauth2client==4.1.3 66 | overrides==7.7.0 67 | packaging==23.2 68 | pandocfilters==1.5.1 69 | parso==0.8.3 70 | pexpect==4.9.0 71 | platformdirs==4.2.0 72 | prometheus-client==0.19.0 73 | prompt-toolkit==3.0.43 74 | protobuf==4.25.2 75 | psutil==5.9.8 76 | ptyprocess==0.7.0 77 | pure-eval==0.2.2 78 | pyasn1==0.5.1 79 | pyasn1-modules==0.3.0 80 | pycparser==2.21 81 | pydantic==2.6.1 82 | pydantic_core==2.16.2 83 | Pygments==2.17.2 84 | pyparsing==3.1.1 85 | python-dateutil==2.8.2 86 | python-json-logger==2.0.7 87 | PyYAML==6.0.1 88 | pyzmq==25.1.2 89 | qtconsole==5.5.1 90 | QtPy==2.4.1 91 | referencing==0.33.0 92 | requests==2.31.0 93 | rfc3339-validator==0.1.4 94 | rfc3986-validator==0.1.1 95 | rpds-py==0.17.1 96 | rsa==4.9 97 | Send2Trash==1.8.2 98 | six==1.16.0 99 | sniffio==1.3.0 100 | soupsieve==2.5 101 | stack-data==0.6.3 102 | terminado==0.18.0 103 | tinycss2==1.2.1 104 | tornado==6.4 105 | traitlets==5.14.1 106 | types-python-dateutil==2.8.19.20240106 107 | typing_extensions==4.9.0 108 | uri-template==1.3.0 109 | urllib3==2.2.0 110 | validators==0.22.0 111 | wcwidth==0.2.13 112 | weaviate-client==4.4.2 113 | webcolors==1.13 114 | webencodings==0.5.1 115 | websocket-client==1.7.0 116 | widgetsnbextension==4.0.9 117 | -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/nvidia/RAPIDS/cuVS-Modal.py: -------------------------------------------------------------------------------- 1 | import modal 2 | 3 | volume = modal.Volume.from_name("cagra-cu-vs", create_if_missing=True) 4 | 5 | image = ( 6 | modal.Image.debian_slim(python_version="3.10") 7 | .pip_install( 8 | [ 9 | "cuvs-cu12", 10 | "cupy==13.2.0", 11 | "sentence-transformers==3.0.1", 12 | "transformers==4.44.2", 13 | "torch==2.1.1", 14 | ], 15 | extra_index_url="https://pypi.nvidia.com" 16 | ) 17 | ) 18 | 19 | MINUTES = 60 20 | HOURS = 5 * MINUTES 21 | 22 | app = modal.App(image=image) # add secrets here when using an embeddings API (ToDo) 23 | 24 | class CAGRA: 25 | @modal.enter() 26 | def init_cagra_graph(self): 27 | # Init CAGRA 28 | from cuvs.neighbors import cagra 29 | self.params = cagra.IndexParams(intermediate_graph_degree=128, 30 | graph_degree=64) 31 | # Init Embedding Service 32 | # ToDo -- move this to download_models.py, I think these are really small models (~500 MB) so not needed yet 33 | from transformers import AutoModel, AutoTokenizer 34 | from sentence_transformers import SentenceTransformer 35 | self.model = AutoModel.from_pretrained("BAAI/bge-small-en-v1.5") 36 | self.tokenizer = AutoTokenizer.from_pretrained("BAAI/bge-small-en-v1.5") 37 | 38 | @modal.method() 39 | def build_cagra_from_embeddings(self, embeddings): 40 | # ToDo find API to add to the existing graph 41 | 42 | # wrap the input vector in a CUDA Numpy array 43 | import cupy as cp 44 | cp_embeddings = cp.asarray(embeddings) 45 | 46 | self.cagra_index = cagra.build_index(cp_embeddings, self.params) 47 | 48 | # Should this be a generator? `is_generator=True` 49 | @modal.method() 50 | def search_cuvs_cagra(self, query, top_k = 5): 51 | # ToDo, extend to test batch queries 52 | 53 | import time 54 | import torch 55 | 56 | # Encode the query using the bi-encoder and find potentially relevant passages 57 | question_embedding = self.model.encode(query, convert_to_tensor=True) 58 | 59 | start_time = time.time() 60 | hits = self.cagra.search(self.params, self.cagra_index, question_embedding[None], top_k) 61 | end_time = time.time() 62 | 63 | score_tensor = torch.as_tensor(hits[0], device='cuda') 64 | index_tensor = torch.as_tensor(hits[1], device='cuda') 65 | return score_tensor, index_tensor 66 | 67 | # Thoughts on Future Work 68 | ''' 69 | 70 | # Still need to understand the best way to move memory around from Weaviate <> CAGRA on Modal 71 | 72 | Could be something like this similar to how Llama3 inference works: 73 | 74 | ``` 75 | Maytbe this approach when only loading in the CAGRA graph for Inference 76 | 77 | try: 78 | volume = modal.Volume.lookup("cagra-cu-vs", create_if_missing=True) 79 | except modal.exception.NotFoundError: 80 | raise Exception("Download models first with modal to run download_llama.py") 81 | 82 | # Save CAGRA graph to Modal volume 83 | @app.function(volumes={"/data": volume}, timeout=4 * HOURS) 84 | def save_cagra_graph(): 85 | pass 86 | 87 | Load CAGRA graph from Weaviate 88 | @app.function(volumes={"/data": volume}, timeout=4 * HOURS) 89 | def load_cagra_graph(weaviate_client, weaviate_collection_name): 90 | pass 91 | 92 | 93 | @app.local_entrypoint() 94 | def main( 95 | weaviate_client, 96 | weaviate_collection_name 97 | ): 98 | load_cagra_graph.remote(weaviate_client, weaviate_collection_name) 99 | ''' 100 | -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/nvidia/RAPIDS/readme.md: -------------------------------------------------------------------------------- 1 | # RAPIDS 2 | 3 | RAPIDS contains libraries for GPU-accelerated data science. 4 | -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/nvidia/RAPIDS/vector-search-on-gpus.md: -------------------------------------------------------------------------------- 1 | # Vector Search on GPUs 2 | 3 | Up until CAGRA, most Approximate Nearest Neighbor Search algorithms tested on GPUs were originally designed for CPUs. CAGRA is built from the ground up to optimize the massive parallelism and memory bandwidth offered by modern GPUs: 4 | 5 | - Massive Parallelism: GPUs have thousands of smaller cores designed to perform many simple tasks simultaneously, which suits highly parallel tasks like vector search. Instead of sequentially searching through the data, a GPU can examine many graph nodes at once, greatly speeding up the search. 6 | 7 | - Memory Bandwidth: GPUs have much higher memory bandwidth than CPUs. While a typical CPU might have memory bandwidth in the range of 50-100 GB/s, modern GPUs can have memory bandwidths exceeding 500 GB/s. For vector searches in large datasets, this means the GPU can load and process data much faster. In CAGRA, this translates to more nodes being checked in parallel, enabling faster searches. 8 | 9 | ## Applications of CAGRA 10 | 11 | ### Query Speed 12 | 13 | A user searches for “wireless headphones” and finds the result in 5 ms versus 1 ms. This is especially pronounced in Compound AI Systems that leverage query writers and perform many searches to complete a task. For example, a system that searches in 1 ms vs. 5 ms is 20 ms faster when the system makes 5 search requests. Studies have shown the link between response time and revenue for products such as e-Commerce stores. 14 | 15 | This further helps with server load. If your system can handle 10,000 searches per second (QPS) with HNSW but 77,000 QPS with CAGRA, you can serve more users with the same hardware or reduce the required hardware for the same load. 16 | 17 | Even faster query speed can be achieved when batching requests to CAGRA. Continuous batching for online latency refers to creating some kind of adaptive strategy with query buffers and time windows to group requests. Some applications more naturally lend themselve to offline computation to leverage batching, such as Recommendation and Generative Feedback Loops. 18 | 19 | ### Time to build the Vector Index: 20 | 21 | Also referred to as TTI (Time-to-Index), across experimental results CAGRA achieves 2.2-27 times faster building time than HNSW on CPUs. We see three main benefits of this: 22 | 23 | Faster Re-Indexing: In environments where data changes frequently, such as product catalogs or news articles, you need to rebuild the graph often. Faster building helps you achieve more up-to-date search results faster. 24 | Save Computational Resources: Further, faster graph building leads to less computational time and resources spent on computing indexes. In our Discussion section, we further explain advances in GPU computing from our friends at Modal and Foundry, to give a couple of examples. 25 | Hyperparameter Tuning: Weaviate’s ANN Benchmarks illustrate what we have found customizing HNSW parameters such as ef, efConstruction, and maxNeighbors to help Weaviate users find the pareto optimal point of memory and query speed. Building the graphs faster further help us test many configurations of CAGRA. 26 | Core Basics of CAGRA 27 | 28 | ### Quick Differences 29 | 30 | - Fixed Out Degree: Every node in the graph has the same number of edges (often set to 32). This is because GPUs perform the best when all threads in a warp (32 threads that execute the same instruction) are doing similar amounts of work. With a fixed out-degree, every thread processes the same number of edges per node, reducing the variance in workload across threads. This is then used in traversal because all threads can explore nodes in lockstep, minimizing synchronization overhead to maximize throughput. The term “lockstep” is used to reference the lack of warp divergence because all threads in a warp are doing the exact same work at the same time. This facilitates GPU throughput optimization. 31 | 32 | - No Hierarchy: HNSW graphs use a multi-layer structure to achieve a “coarse-to-fine” / “zoom-out / zoom-in” approach to nearest neighbor routing. On GPUs, handling multiple levels of hierarchy can be inefficient because you have many threads that need to be synchronized. Thus, CAGRA utilizes a flat, fixed-degree to more efficiently parallelize the search with GPU threds. 33 | 34 | ## Core Innovations 35 | 36 | ### Reordering and Reverse Edge Addition 37 | 38 | The initial CAGRA graph is built with NN-Descent. NN-Descent is an iterative optimization algorithm, swapping neighbors with neighbors, round by round. CAGRA then reorders neihgbors by how well they contribute to “2-hop connectivity”. Note, this is similar to the mechanism used in ACORN to speed up Filtered Vector Search. After re-ordering, edges are pruned to maintain the fixed out-degree. All neighbor connections are then made bi-directional with reverse edge addition. 39 | 40 | ## GPU Optimization 41 | 42 | - GPU Warps: A warp is a group of 32 threads that execut ethe same instruction at the same time on a GPU. By grouping threads into warps, the GPU can execute many distance computations or graph traversals in parallel. If all threads in a warp do similar work (like processing nodes with a fixed out-degree), it maximizes hardware utilization. 43 | 44 | - Forgettable Hash Table Management: Whereas HNSW implementations typically use a static visited list, CAGRA deploys a forgettable hash table to save memory. This may reduce in some redundant neighbor explorations, but this tradeoff is minimal thanks to the massive parallelization of node exploration. 45 | 46 | ## Discussion 47 | 48 | ### GPU Computing Infrastructure and Weaviate 49 | 50 | The cost benefit potential of GPU computing is further being pioneered by our partners at Modal and Foundry, to give a couple of examples. Paraphrasing from Jared Quincy Davis on the No Priors podcast, GPU computing is like a parking lot business. Say Erik pays for a $100 premium membership in a fancy downtown lot and Connor pays for a $10 standard membership. Connor is able to park in Erik’s fancy spot next to the elevator while Erik is away. However, when Erik returns to the parking lot to park his car, Connor’s car must be moved to a spot in the standard lot zone. This transfer of “car” or “GPU-enabled runtime state” from spot tier to spot tier has been tremendously difficult until recent innovations from Modal and Foundry. 51 | -------------------------------------------------------------------------------- /integrations/cloud-hyperscalers/nvidia/readme.md: -------------------------------------------------------------------------------- 1 | # NVIDIA 2 | -------------------------------------------------------------------------------- /integrations/compute-infrastructure/modal/Modal-cuVS.py: -------------------------------------------------------------------------------- 1 | import modal 2 | 3 | volume = modal.Volume.from_name("cagra-cu-vs", create_if_missing=True) 4 | 5 | image = ( 6 | modal.Image.debian_slim(python_version="3.10") 7 | .pip_install( 8 | [ 9 | "cuvs-cu12", 10 | "cupy==13.2.0", 11 | "sentence-transformers==3.0.1", 12 | "transformers==4.44.2", 13 | "torch==2.1.1", 14 | ], 15 | extra_index_url="https://pypi.nvidia.com" 16 | ) 17 | ) 18 | 19 | MINUTES = 60 20 | HOURS = 5 * MINUTES 21 | 22 | app = modal.App(image=image) # add secrets here when using an embeddings API (ToDo) 23 | 24 | class CAGRA: 25 | @modal.enter() 26 | def init_cagra_graph(self): 27 | # Init CAGRA 28 | from cuvs.neighbors import cagra 29 | self.params = cagra.IndexParams(intermediate_graph_degree=128, 30 | graph_degree=64) 31 | # Init Embedding Service 32 | # ToDo -- move this to download_models.py, I think these are really small models (~500 MB) so not needed yet 33 | from transformers import AutoModel, AutoTokenizer 34 | from sentence_transformers import SentenceTransformer 35 | self.model = AutoModel.from_pretrained("BAAI/bge-small-en-v1.5") 36 | self.tokenizer = AutoTokenizer.from_pretrained("BAAI/bge-small-en-v1.5") 37 | 38 | @modal.method() 39 | def build_cagra_from_embeddings(self, embeddings): 40 | # ToDo find API to add to the existing graph 41 | 42 | # wrap the input vector in a CUDA Numpy array 43 | import cupy as cp 44 | cp_embeddings = cp.asarray(embeddings) 45 | 46 | self.cagra_index = cagra.build_index(cp_embeddings, self.params) 47 | 48 | # Should this be a generator? `is_generator=True` 49 | @modal.method() 50 | def search_cuvs_cagra(self, query, top_k = 5): 51 | # ToDo, extend to test batch queries 52 | 53 | import time 54 | import torch 55 | 56 | # Encode the query using the bi-encoder and find potentially relevant passages 57 | question_embedding = self.model.encode(query, convert_to_tensor=True) 58 | 59 | start_time = time.time() 60 | hits = self.cagra.search(self.params, self.cagra_index, question_embedding[None], top_k) 61 | end_time = time.time() 62 | 63 | score_tensor = torch.as_tensor(hits[0], device='cuda') 64 | index_tensor = torch.as_tensor(hits[1], device='cuda') 65 | return score_tensor, index_tensor 66 | 67 | # Thoughts on Future Work 68 | ''' 69 | 70 | # Still need to understand the best way to move memory around from Weaviate <> CAGRA on Modal 71 | 72 | Could be something like this similar to how Llama3 inference works: 73 | 74 | ``` 75 | Maytbe this approach when only loading in the CAGRA graph for Inference 76 | 77 | try: 78 | volume = modal.Volume.lookup("cagra-cu-vs", create_if_missing=True) 79 | except modal.exception.NotFoundError: 80 | raise Exception("Download models first with modal to run download_llama.py") 81 | 82 | # Save CAGRA graph to Modal volume 83 | @app.function(volumes={"/data": volume}, timeout=4 * HOURS) 84 | def save_cagra_graph(): 85 | pass 86 | 87 | Load CAGRA graph from Weaviate 88 | @app.function(volumes={"/data": volume}, timeout=4 * HOURS) 89 | def load_cagra_graph(weaviate_client, weaviate_collection_name): 90 | pass 91 | 92 | 93 | @app.local_entrypoint() 94 | def main( 95 | weaviate_client, 96 | weaviate_collection_name 97 | ): 98 | load_cagra_graph.remote(weaviate_client, weaviate_collection_name) 99 | ''' 100 | -------------------------------------------------------------------------------- /integrations/compute-infrastructure/modal/download_llama.py: -------------------------------------------------------------------------------- 1 | import modal 2 | 3 | HF_TOKEN = "YOUR_HUGGINGFACE_TOKEN" # Replace this with your HuggingFace Token 4 | MODELS_DIR = "/llamas" 5 | MODEL_ID = "meta-llama/Meta-Llama-3.1-8B-Instruct" 6 | MODEL_REVISION = "8c22764a7e3675c50d4c7c9a4edb474456022b16" # pin model revisions to prevent unexpected changes! 7 | 8 | volume = modal.Volume.from_name("llamas", create_if_missing=True) 9 | 10 | image = ( 11 | modal.Image.debian_slim(python_version="3.10") 12 | .pip_install( 13 | [ 14 | "huggingface_hub", # download models from the Hugging Face Hub 15 | "hf-transfer", # download models faster with Rust 16 | ] 17 | ) 18 | .env({"HF_HUB_ENABLE_HF_TRANSFER": "1"}) 19 | ) 20 | 21 | MINUTES = 60 22 | HOURS = 60 * MINUTES 23 | 24 | 25 | app = modal.App(image=image, secrets=[modal.Secret.from_name("huggingface-secret")]) 26 | 27 | 28 | @app.function(volumes={MODELS_DIR: volume}, timeout=4 * HOURS) 29 | def download_model(model_name, model_revision, force_download=False): 30 | 31 | from huggingface_hub import snapshot_download 32 | 33 | volume.reload() 34 | 35 | snapshot_download( 36 | MODEL_ID, 37 | local_dir=MODELS_DIR, 38 | ignore_patterns=[ 39 | "*.pt", 40 | "*.bin", 41 | "*.pth", 42 | "original/*", 43 | ], # Ensure safetensors 44 | revision=MODEL_REVISION, 45 | token=HF_TOKEN, 46 | ) 47 | 48 | volume.commit() 49 | 50 | 51 | @app.local_entrypoint() 52 | def main( 53 | model_name: str = MODEL_ID, 54 | model_revision: str = MODEL_REVISION, 55 | force_download: bool = False, 56 | ): 57 | download_model.remote(model_name, model_revision, force_download) 58 | 59 | 60 | def extract_assistant_response(output_text): 61 | """Model-specific code to extract model responses. 62 | 63 | See this doc for LLaMA 3: https://llama.meta.com/docs/model-cards-and-prompt-formats/meta-llama-3/. 64 | """ 65 | # Split the output text by the assistant header token 66 | parts = output_text.split("<|start_header_id|>assistant<|end_header_id|>") 67 | 68 | if len(parts) > 1: 69 | # Join the parts after the first occurrence of the assistant header token 70 | response = parts[1].split("<|eot_id|>")[0].strip() 71 | 72 | # Remove any remaining special tokens and whitespace 73 | response = response.replace("<|eot_id|>", "").strip() 74 | 75 | return response 76 | else: 77 | return output_text 78 | -------------------------------------------------------------------------------- /integrations/compute-infrastructure/modal/modal_vllm_query.py: -------------------------------------------------------------------------------- 1 | import ast 2 | import json 3 | import requests 4 | import time 5 | 6 | url = "https://YOUR_MODAL_USERNAME_AND_APP_NAME-web-dev.modal.run" # replace with the result of `modal deploy modal_web_endpoint.py` 7 | headers = { 8 | "Content-Type": "application/json", 9 | "Authorization": "Bearer YOUR_MODAL_API_KEY", # replace with your Modal API Key 10 | } 11 | 12 | payload = { 13 | "prompts": ["What is the capital of France?"], 14 | } 15 | 16 | start_time = time.time() 17 | response = requests.post(url, headers=headers, json=payload) 18 | end_time = time.time() 19 | 20 | if response.status_code == 200: 21 | response_list = ast.literal_eval(response.text) 22 | for i in response_list: 23 | print("=" * 50) 24 | print(i) 25 | 26 | # Add details about the number of answers, time taken, and average time per task 27 | print("\n" + "=" * 50) 28 | total_time = end_time - start_time 29 | num_tasks = len(response_list) 30 | print(f"Number of answers: {num_tasks}") 31 | print(f"Total time taken: {total_time:.2f} seconds") 32 | print(f"Average time per task: {total_time / num_tasks:.2f} seconds") 33 | else: 34 | print(f"Error: {response.status_code}") 35 | print(response.text) 36 | -------------------------------------------------------------------------------- /integrations/compute-infrastructure/modal/modal_web_server.py: -------------------------------------------------------------------------------- 1 | import modal 2 | import modal.gpu 3 | from fastapi import Depends, HTTPException, status 4 | from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer 5 | 6 | from vllm_outlines_setup import Model, app 7 | 8 | MINUTE = 60 9 | 10 | web_image = modal.Image.debian_slim(python_version="3.10") 11 | 12 | auth_scheme = HTTPBearer() 13 | 14 | 15 | @app.function( 16 | image=web_image, 17 | # secrets=[modal.Secret.from_name("my-inference-secret")], 18 | container_idle_timeout=MINUTE 19 | * 20, # keeps web container alive for 20 minutes (the max) 20 | ) 21 | @modal.web_endpoint(method="POST") 22 | def generate_web( 23 | data: dict, token: HTTPAuthorizationCredentials = Depends(auth_scheme) 24 | ): 25 | import os 26 | 27 | ''' 28 | if token.credentials != os.environ["LLM_INFERENCE_KEY"]: 29 | raise HTTPException( 30 | status_code=status.HTTP_401_UNAUTHORIZED, 31 | detail="Incorrect bearer token", 32 | headers={"WWW-Authenticate": "Bearer"}, 33 | ) 34 | ''' 35 | return Model.generate.remote_gen(data["prompts"], settings=None) 36 | -------------------------------------------------------------------------------- /integrations/compute-infrastructure/modal/readme.md: -------------------------------------------------------------------------------- 1 | ## Embed and Search Text at Scale with Modal and Weaviate 2 | 3 | In this demo, we built a full application that discovers analogies between Wikipedia articles by combining serverless infrastructure from Modal with the search and storage capabilities of Weaviate. 4 | 5 | Resources: 6 | * [Repository](https://github.com/modal-labs/vector-analogies-wikipedia) 7 | * [Blog Post](https://weaviate.io/blog/modal-and-weaviate) 8 | 9 | ## Modal + vLLM + Outlines 10 | 11 | There are additionally four files in this repo that demonstrate how to setup a vLLM server with Outlines Structured Decoding on Modal: 12 | 13 | To achieve this run these commands: 14 | ```bash 15 | modal run download_llama.py 16 | modal deploy vllm_outlines_setup.py 17 | ``` 18 | 19 | Test with: 20 | ```bash 21 | python3 vllm_outlines_query.py 22 | ``` 23 | 24 | Learn more about vLLM [here](https://github.com/vllm-project/vllm)! 25 | Learn more about Outlines Structured Decoding [here](https://github.com/outlines-dev/outlines)! 26 | 27 | ## Modal + cuVS 28 | 29 | We are additionally researching Vector Search on GPUs with NVIDIA's cuVS and Modal's GPU computing infrastructure. 30 | 31 | Learn more about CAGRA [here])https://arxiv.org/pdf/2308.15136)! 32 | -------------------------------------------------------------------------------- /integrations/compute-infrastructure/modal/vllm_outlines_setup.py: -------------------------------------------------------------------------------- 1 | import modal 2 | 3 | vllm_image = modal.Image.debian_slim(python_version="3.10").pip_install( 4 | "vllm==0.5.3post1", "outlines==0.0.46" 5 | ) 6 | 7 | MODELS_DIR = "/llamas" 8 | MODEL_NAME = "meta-llama/Meta-Llama-3.1-8B-Instruct" 9 | MODEL_REVISION = "8c22764a7e3675c50d4c7c9a4edb474456022b16" 10 | 11 | try: 12 | volume = modal.Volume.lookup("llamas", create_if_missing=False) 13 | except modal.exception.NotFoundError: 14 | raise Exception("Download models first with modal run download_llama.py") 15 | 16 | N_GPUS=1 17 | GPU_CONFIG = modal.gpu.A100(count=N_GPUS) 18 | MINUTES = 60 19 | DTYPE = "float16" 20 | MAX_INPUT_LEN = 256 21 | MAX_OUTPUT_LEN = 256 22 | 23 | app = modal.App("example-vllm-outlines", image=vllm_image) 24 | 25 | from pydantic import BaseModel 26 | class Answer(BaseModel): 27 | answer: str 28 | confidence_rating: float 29 | 30 | @app.cls( 31 | gpu=GPU_CONFIG, container_idle_timeout=1 * MINUTES, volumes={MODELS_DIR: volume} 32 | ) 33 | class Model: 34 | @modal.enter() 35 | def load(self): 36 | """Loads the VLLM engine and configures our tokenizer.""" 37 | 38 | from vllm import EngineArgs, LLMEngine, SamplingParams 39 | from outlines.integrations.vllm import JSONLogitsProcessor 40 | import vllm 41 | 42 | volume.reload() 43 | 44 | engine_args = EngineArgs( 45 | model=MODELS_DIR, 46 | tensor_parallel_size=N_GPUS, 47 | gpu_memory_utilization=0.9, 48 | max_model_len=8096, 49 | enforce_eager=False, 50 | dtype=DTYPE, 51 | ) 52 | 53 | self.engine = LLMEngine.from_engine_args(engine_args) 54 | 55 | logits_processor = JSONLogitsProcessor(schema=Answer, llm=self.engine) 56 | 57 | self.sampling_params = SamplingParams( 58 | max_tokens=MAX_OUTPUT_LEN, 59 | temperature=0.7, 60 | logits_processors=[logits_processor], 61 | ) 62 | 63 | @modal.method(is_generator=True) 64 | def generate(self, prompts: list[str], settings=None): 65 | """Generate responses to a batch of prompts, optionally with custom inference settings.""" 66 | from vllm import SamplingParams 67 | 68 | request_id = 0 69 | 70 | # Add all prompts to the engine 71 | for prompt in prompts: 72 | sampling_params = ( 73 | self.sampling_params if settings is None else SamplingParams(**settings) 74 | ) 75 | self.engine.add_request(str(request_id), prompt, sampling_params) 76 | request_id += 1 77 | 78 | # Process requests and yield results 79 | while self.engine.has_unfinished_requests(): 80 | request_outputs = self.engine.step() 81 | for request_output in request_outputs: 82 | if request_output.finished: 83 | yield request_output.outputs[0].text 84 | -------------------------------------------------------------------------------- /integrations/data-platforms/airbyte/README.md: -------------------------------------------------------------------------------- 1 | # Airbyte 2 | Airbyte is an open-source data integration engine that helps you consolidate your data in your data warehouses, lakes and databases. You can use Airbyte to ingest data into Weaviate. 3 | 4 | # Examples 5 | 1. [How to load data from Unleash to Weaviate](https://airbyte.com/how-to-sync/unleash-to-weaviate) 6 | 2. [How to load data from Airtable to Weaviate](https://airbyte.com/how-to-sync/airtable-to-weaviate) 7 | 3. [How to load data from Monday to Weaviate](https://airbyte.com/how-to-sync/monday-to-weaviate) -------------------------------------------------------------------------------- /integrations/data-platforms/astronomer/README.md: -------------------------------------------------------------------------------- 1 | # Astronomer 2 | Astronomer’s Astro is a fully managed platform built on top of Apache Airflow. It simplifies the management of Airflow at scale and data ingestion into Weaviate. 3 | 4 | # Examples 5 | 6 | 1. [Orchestrate Weaviate operations with Apache Airflow using Astronomer](https://github.com/astronomer/airflow-weaviate-tutorial) 7 | -------------------------------------------------------------------------------- /integrations/data-platforms/box/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Alex Novotny 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /integrations/data-platforms/box/README.md: -------------------------------------------------------------------------------- 1 | “box-dev” 5 | 6 | # Weaviate Box Recipe Demo 7 | 8 | Please download this folder and run the Jupyter Notebook in your preferred location. The instructions for this recipe are all contained in the notebook. -------------------------------------------------------------------------------- /integrations/data-platforms/box/demo_files/aapl_2023.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/data-platforms/box/demo_files/aapl_2023.pdf -------------------------------------------------------------------------------- /integrations/data-platforms/box/demo_files/aapl_2024.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/data-platforms/box/demo_files/aapl_2024.pdf -------------------------------------------------------------------------------- /integrations/data-platforms/box/demo_files/google_2023.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/data-platforms/box/demo_files/google_2023.pdf -------------------------------------------------------------------------------- /integrations/data-platforms/box/demo_files/google_2024.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/data-platforms/box/demo_files/google_2024.pdf -------------------------------------------------------------------------------- /integrations/data-platforms/box/images/boxdev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/data-platforms/box/images/boxdev.png -------------------------------------------------------------------------------- /integrations/data-platforms/confluent-cloud/README.md: -------------------------------------------------------------------------------- 1 | # Confluent Cloud 2 | 3 | Confluent Cloud is a fully managed Apache Kafka service that offers real-time data streaming with seamless integration across major cloud providers, high performance, and robust security features. Learn more at [Confluent Cloud](https://www.confluent.io/confluent-cloud/). 4 | 5 | # Streaming Data Into Weaviate 6 | 7 | You can stream data from Confluent Cloud to Weaviate using the [Weaviate Confluent Connector](https://github.com/weaviate/confluent-connector). For setup and usage details, refer to the connector's [README](https://github.com/weaviate/confluent-connector/blob/main/README.md). 8 | 9 | # Examples 10 | 11 | For end-to-end examples of how the integration works, check out the demo notebooks available [here](https://github.com/weaviate/confluent-connector/tree/main/notebooks). These include examples with PySpark, Confluent and Weaviate, Confluent and WCS, and Confluent and Databricks. 12 | -------------------------------------------------------------------------------- /integrations/data-platforms/context-data/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## About VectorETL 3 | VectorETL by [Context Data](https://contextdata.ai) is a modular no-code Python framework designed to help AI and Data Engineers to: 4 | - Quickly extract data from multiple data sources (databases, cloud storage, and local files) 5 | - Embed using major models (including OpenAI, Cohere, and Google Gemini) 6 | - Write to all major vector vector databases (Weaviate et al) 7 | 8 | ## How to run 9 | 1. Install VectorETL using `pip install vector-etl` 10 | 2. Configure a yaml configuration file (see example below) 11 | 12 | ```yaml 13 | source: 14 | source_data_type: "Local File" 15 | file_path: "./customers-100.csv" 16 | file_type: "csv" 17 | chunk_size: 1000 18 | chunk_overlap: 0 19 | 20 | embedding: 21 | embedding_model: "OpenAI" 22 | api_key: "your-openai-key" #replace with your OpenAI API key 23 | model_name: "text-embedding-ada-002" 24 | 25 | target: 26 | target_database: "Weaviate" 27 | weaviate_url: "https://your-cluster-details.weaviate.cloud" #replace with your Weaviate cluster url 28 | weaviate_api_key: "your-cluster-api-key" #replace with your Weaviate API keys 29 | class_name: "customers" 30 | 31 | embed_columns: [] 32 | ``` 33 | 34 | 3. Execute your pipeline using `vector-etl -c /path/to/config.yaml` 35 | 36 | **That's it!** 37 | 38 | ## Additional Example Configuration Files 39 | 40 | We have included some additional configuration examples in the [examples](examples) directory. These examples illustrate how to use VectorETL with a range of data sources and embedding models. 41 | 42 | 1. **gcs-to-weaviate-using-cohere.yaml**: Extract file(s) from Google Cloud Storage, embed using Cohere and write the resulting embeddings to Weaviate 43 | 2. **postgres-to-weaviate.yaml**: Extract data from a PostgreSQL table using a defined SQL statement, embed the results using Cohere and write the resulting embeddings to Weaviate 44 | 3. **s3-to-weaviate.yaml**: Extract file(s) from Amazon S3, embed using Cohere and write the resulting embeddings to Weaviate 45 | 46 | Happy Vectoring! 47 | -------------------------------------------------------------------------------- /integrations/data-platforms/context-data/config.yaml: -------------------------------------------------------------------------------- 1 | source: 2 | source_data_type: "Local File" 3 | file_path: "./customers-100.csv" 4 | file_type: "csv" 5 | chunk_size: 1000 6 | chunk_overlap: 0 7 | 8 | embedding: 9 | embedding_model: "OpenAI" 10 | api_key: "your-openai-key" #replace with your OpenAI API key 11 | model_name: "text-embedding-ada-002" 12 | 13 | target: 14 | target_database: "Weaviate" 15 | weaviate_url: "https://your-cluster-details.weaviate.cloud" #replace with your Weaviate cluster url 16 | weaviate_api_key: "your-cluster-api-key" #replace with your Weaviate API keys 17 | class_name: "customers" 18 | 19 | embed_columns: [] 20 | -------------------------------------------------------------------------------- /integrations/data-platforms/context-data/examples/gcs-to-weaviate-using-cohere.yaml: -------------------------------------------------------------------------------- 1 | source: 2 | source_data_type: "Google Cloud Storage" 3 | credentials_path: "/path/to/your/credentials.json" 4 | bucket_name: "myBucket" 5 | prefix: "prefix/" 6 | file_type: "csv" #required if prefix is a directory: Will retrieve all files with filetype 7 | chunk_size: 1000 #[Optional] Default is 1000 8 | chunk_overlap: 0 #[Optional] Default is 0 9 | 10 | embedding: 11 | embedding_model: "Cohere" 12 | api_key: "my-cohere-key" 13 | model_name: "embed-english-v3.0" 14 | 15 | target: 16 | target_database: "Weaviate" 17 | weaviate_url: "https://your-cluster-details.weaviate.cloud" #replace with your Weaviate cluster url 18 | weaviate_api_key: "your-cluster-api-key" #replace with your Weaviate API keys 19 | class_name: "collection-name" #replace with an existing or new collection name 20 | 21 | embed_columns: [] #Empty Array: File based sources do not require embedding columns -------------------------------------------------------------------------------- /integrations/data-platforms/context-data/examples/postgres-to-weaviate.yaml: -------------------------------------------------------------------------------- 1 | source: 2 | source_data_type: "database" 3 | db_type: "postgres" 4 | host: "localhost" 5 | database_name: "mydb" 6 | username: "user" 7 | password: "password" 8 | port: 5432 9 | query: "SELECT * FROM mytable WHERE updated_at > :last_updated_at" 10 | batch_size: 1000 #[Optional] Default is 1000 11 | chunk_size: 1000 #[Optional] Default is 1000 12 | chunk_overlap: 0 #[Optional] Default is 0 13 | 14 | embedding: 15 | embedding_model: "Cohere" 16 | api_key: "my-cohere-key" 17 | model_name: "embed-english-v3.0" 18 | 19 | target: 20 | target_database: "Weaviate" 21 | weaviate_url: "https://your-cluster-details.weaviate.cloud" #replace with your Weaviate cluster url 22 | weaviate_api_key: "your-cluster-api-key" #replace with your Weaviate API keys 23 | class_name: "collection-name" #replace with an existing or new collection name 24 | 25 | embed_columns: 26 | - "column1" 27 | - "column2" 28 | - "column3" -------------------------------------------------------------------------------- /integrations/data-platforms/context-data/examples/s3-to-weaviate.yaml: -------------------------------------------------------------------------------- 1 | source: 2 | source_data_type: "Amazon S3" 3 | bucket_name: "myBucket" 4 | prefix: "Dir/Subdir/" 5 | file_type: "csv" #required if prefix is a directory: Will retrieve all files with filetype 6 | aws_access_key_id: "your-access-key" 7 | aws_secret_access_key: "your-secret-access-key" 8 | 9 | embedding: 10 | embedding_model: "Cohere" 11 | api_key: "my-cohere-key" 12 | model_name: "embed-english-v3.0" 13 | 14 | target: 15 | target_database: "Weaviate" 16 | weaviate_url: "https://your-cluster-details.weaviate.cloud" #replace with your Weaviate cluster url 17 | weaviate_api_key: "your-cluster-api-key" #replace with your Weaviate API keys 18 | class_name: "collection-name" #replace with an existing or new collection name 19 | 20 | embed_columns: [] #Empty Array: File based sources do not require embedding columns -------------------------------------------------------------------------------- /integrations/data-platforms/huggingface/images/huggingface-datasets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/data-platforms/huggingface/images/huggingface-datasets.png -------------------------------------------------------------------------------- /integrations/data-platforms/huggingface/weaviate-collection-to-hf-dataset-hub.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Weaviate Collection to HuggingFace Dataset Hub\n", 8 | "\n", 9 | "This notebook will show you how to upload the data stored in a Weaviate Collection onto the HuggingFace Dataset Hub!" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 2, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "import weaviate\n", 19 | "import os\n", 20 | "from weaviate.classes.init import Auth\n", 21 | "import weaviate.classes.config as wvcc\n", 22 | "import re\n", 23 | "from weaviate.util import get_valid_uuid\n", 24 | "from uuid import uuid4" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": 4, 30 | "metadata": {}, 31 | "outputs": [ 32 | { 33 | "name": "stdout", 34 | "output_type": "stream", 35 | "text": [ 36 | "True\n" 37 | ] 38 | } 39 | ], 40 | "source": [ 41 | "WEAVIATE_URL = os.getenv(\"WEAVIATE_URL\")\n", 42 | "WEAVIATE_API_KEY = os.getenv(\"WEAVIATE_API_KEY\")\n", 43 | "\n", 44 | "weaviate_client = weaviate.connect_to_weaviate_cloud(\n", 45 | " cluster_url=WEAVIATE_URL,\n", 46 | " auth_credentials=Auth.api_key(WEAVIATE_API_KEY)\n", 47 | ")\n", 48 | "\n", 49 | "print(weaviate_client.is_ready())" 50 | ] 51 | }, 52 | { 53 | "cell_type": "markdown", 54 | "metadata": {}, 55 | "source": [ 56 | "### Replace this with the name of the Weaviate Collection you want to upload!" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": 5, 62 | "metadata": {}, 63 | "outputs": [], 64 | "source": [ 65 | "blogs_collection = weaviate_client.collections.get(\"WeaviateBlogChunks\")" 66 | ] 67 | }, 68 | { 69 | "cell_type": "code", 70 | "execution_count": 8, 71 | "metadata": {}, 72 | "outputs": [ 73 | { 74 | "name": "stdout", 75 | "output_type": "stream", 76 | "text": [ 77 | "\u001b[32mProcessed 2160 items in 1.88 seconds\u001b[0m\n" 78 | ] 79 | } 80 | ], 81 | "source": [ 82 | "import time\n", 83 | "\n", 84 | "data = []\n", 85 | "\n", 86 | "start_time = time.time()\n", 87 | "\n", 88 | "for item in blogs_collection.iterator():\n", 89 | " values_dictionary = {}\n", 90 | " values_dictionary[\"uuid\"] = str(item.uuid)\n", 91 | " for key in item.properties.keys():\n", 92 | " values_dictionary[key] = item.properties[key]\n", 93 | " data.append(values_dictionary)\n", 94 | "\n", 95 | "end_time = time.time()\n", 96 | "execution_time = end_time - start_time\n", 97 | "\n", 98 | "print(f\"\\033[32mProcessed {len(data)} items in {execution_time:.2f} seconds\\033[0m\")" 99 | ] 100 | }, 101 | { 102 | "cell_type": "code", 103 | "execution_count": 10, 104 | "metadata": {}, 105 | "outputs": [], 106 | "source": [ 107 | "import json\n", 108 | "with open(\"./weaviate-blogs-with-synthetic-questions.json\", \"w\") as json_file:\n", 109 | " json.dump(data, json_file, indent=4)" 110 | ] 111 | }, 112 | { 113 | "cell_type": "markdown", 114 | "metadata": {}, 115 | "source": [ 116 | "### Upload to HuggingFace Dataset Hub!" 117 | ] 118 | }, 119 | { 120 | "cell_type": "code", 121 | "execution_count": 11, 122 | "metadata": {}, 123 | "outputs": [ 124 | { 125 | "data": { 126 | "text/plain": [ 127 | "CommitInfo(commit_url='https://huggingface.co/datasets/weaviate/weaviate-blogs-with-synthetic-questions/commit/dde65e64bb9ee3c9ff7585fbd3fc988fb4b27bc0', commit_message='Upload weaviate-blogs-with-synthetic-questions.json with huggingface_hub', commit_description='', oid='dde65e64bb9ee3c9ff7585fbd3fc988fb4b27bc0', pr_url=None, repo_url=RepoUrl('https://huggingface.co/datasets/weaviate/weaviate-blogs-with-synthetic-questions', endpoint='https://huggingface.co', repo_type='dataset', repo_id='weaviate/weaviate-blogs-with-synthetic-questions'), pr_revision=None, pr_num=None)" 128 | ] 129 | }, 130 | "execution_count": 11, 131 | "metadata": {}, 132 | "output_type": "execute_result" 133 | } 134 | ], 135 | "source": [ 136 | "from huggingface_hub import HfApi\n", 137 | "\n", 138 | "hf_api = HfApi(\n", 139 | " endpoint=\"https://huggingface.co\",\n", 140 | " token=os.getenv(\"HUGGINGFACE_TOKEN\")\n", 141 | ")\n", 142 | "\n", 143 | "hf_api.create_repo(\n", 144 | " repo_id=\"weaviate/weaviate-blogs-with-synthetic-questions\",\n", 145 | " token=os.getenv(\"HUGGINGFACE_TOKEN\"),\n", 146 | " repo_type=\"dataset\"\n", 147 | ")\n", 148 | "\n", 149 | "hf_api.upload_file(\n", 150 | " path_or_fileobj=\"./weaviate-blogs-with-synthetic-questions.json\",\n", 151 | " path_in_repo=\"weaviate-blogs-with-synthetic-questions.json\",\n", 152 | " repo_id=\"weaviate/weaviate-blogs-with-synthetic-questions\",\n", 153 | " repo_type=\"dataset\"\n", 154 | ")" 155 | ] 156 | }, 157 | { 158 | "cell_type": "markdown", 159 | "metadata": {}, 160 | "source": [ 161 | "# ![HuggingFace Dataset](./images/huggingface-datasets.png \"HuggingFace Dataset\")" 162 | ] 163 | } 164 | ], 165 | "metadata": { 166 | "kernelspec": { 167 | "display_name": "Python 3", 168 | "language": "python", 169 | "name": "python3" 170 | }, 171 | "language_info": { 172 | "codemirror_mode": { 173 | "name": "ipython", 174 | "version": 3 175 | }, 176 | "file_extension": ".py", 177 | "mimetype": "text/x-python", 178 | "name": "python", 179 | "nbconvert_exporter": "python", 180 | "pygments_lexer": "ipython3", 181 | "version": "3.10.10" 182 | } 183 | }, 184 | "nbformat": 4, 185 | "nbformat_minor": 2 186 | } 187 | -------------------------------------------------------------------------------- /integrations/data-platforms/spark/tiny_Jeopardy.json: -------------------------------------------------------------------------------- 1 | [{"Category": "SCIENCE", "Question": "This organ removes excess glucose from the blood & stores it as glycogen", "Answer": "Liver"}, {"Category": "ANIMALS", "Question": "It's the only living mammal in the order Proboseidea", "Answer": "Elephant"}, {"Category": "ANIMALS", "Question": "The gavial looks very much like a crocodile except for this bodily feature", "Answer": "the nose or snout"}, {"Category": "ANIMALS", "Question": "Weighing around a ton, the eland is the largest species of this animal in Africa", "Answer": "Antelope"}, {"Category": "ANIMALS", "Question": "Heaviest of all poisonous snakes is this North American rattlesnake", "Answer": "the diamondback rattler"}, {"Category": "SCIENCE", "Question": "2000 news: the Gunnison sage grouse isn't just another northern sage grouse, but a new one of this classification", "Answer": "species"}, {"Category": "SCIENCE", "Question": "A metal that is ductile can be pulled into this while cold & under pressure", "Answer": "wire"}, {"Category": "SCIENCE", "Question": "In 1953 Watson & Crick built a model of the molecular structure of this, the gene-carrying substance", "Answer": "DNA"}, {"Category": "SCIENCE", "Question": "Changes in the tropospheric layer of this are what gives us weather", "Answer": "the atmosphere"}, {"Category": "SCIENCE", "Question": "In 70-degree air, a plane traveling at about 1,130 feet per second breaks it", "Answer": "Sound barrier"}] -------------------------------------------------------------------------------- /integrations/data-platforms/web-search/firecrawl/readme.md: -------------------------------------------------------------------------------- 1 | # Firecrawl by Mendable 2 | 3 | Firecrawl is a AI first web scraping tool that allows you to easily crawl and extract clean, structured data from websites for use in LLM applications. It handles the complexities of web scraping like proxies, caching, rate limits, and dynamic content, delivering markdown or JSON output that is ready to be ingested into vector databases like Weaviate. 4 | 5 | ## Some key features of Firecrawl: 6 | 7 | Crawls all accessible subpages of a website, even without a sitemap 8 | Extracts content from webpages that use JavaScript to render 9 | Returns the scraped data as clean, well-formatted markdown or structured JSON 10 | Orchestrates parallel crawling for fast results 11 | Built-in caching to avoid unnecessary re-scraping 12 | Designed specifically for AI/LLM use cases 13 | 14 | ## How Firecrawl Works 15 | Firecrawl makes it simple to extract clean, structured data from websites through a straightforward process: 16 | 17 | 1. Specify the URL(s) you want to crawl. This can be a single webpage, a list of pages, or an entire website. Firecrawl will automatically discover and crawl all accessible subpages. 18 | 2. Firecrawl handles the crawling process, navigating through the website's structure and rendering any dynamic content generated by JavaScript. It extracts the main textual content from each page, ignoring extraneous elements like headers, footers, and navigation. 19 | 3. The extracted content is cleaned up and formatted into your choice of markdown documents or structured JSON objects. Each webpage becomes its own document or JSON object, complete with the page's URL and the extracted text content. 20 | 4. Firecrawl returns this cleaned, structured data for you to use however you need. The output format is designed to be easily ingested by AI/LLM applications and tools. 21 | 5. You can then take the Firecrawl output and import it into your database, feed it into your machine learning models, use it to build a knowledge base, or any other application you have in mind. The data is ready to be used without any further cleaning or pre-processing needed. 22 | 23 | Firecrawl takes care of all the complexities of web scraping - handling site maps, following links, dealing with rate limits, rendering JavaScript, cleaning up messy HTML - and gives you back clean, usable data in a standardized format. 24 | 25 | ## Example Firecrawl Output 26 | Here's an example of what the scraped output from Firecrawl might look like for a simple website: 27 | 28 | ```json 29 | [ 30 | { 31 | "url": "https://www.example.com/", 32 | "markdown": "## Welcome to Example Co\nExample Co is the leading innovator in example products and services..." 33 | }, 34 | { 35 | "url": "https://www.example.com/about", 36 | "markdown": "## About Example Co\nFounded in 2015, Example Co's mission is to..." 37 | }, 38 | { 39 | "url": "https://www.example.com/products", 40 | "markdown": "## Our Products\n### Example Product 1\nOur flagship example product enables..." 41 | } 42 | ] 43 | ``` 44 | 45 | Learn more about Firecrawl [here](https://www.firecrawl.dev/)! 46 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/data/2022-10-25-lock-striping-pattern/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: How we solved a race condition with the Lock Striping pattern 3 | slug: Lock-striping-pattern 4 | authors: [dirk] 5 | date: 2022-10-25 6 | tags: ['engineering'] 7 | image: ./img/hero.png 8 | description: "The Lock Striping pattern is a great way to solve race conditions without sacrificing performance. Lean about Weaviate's improvements." 9 | --- 10 | ![How we solved a race condition with the Lock Striping pattern](./img/hero.png) 11 | 12 | 13 | 14 | ## Lock striping in database design 15 | Database design comes with interesting challenges. Like, dealing with race conditions when importing data in parallel streams. But for every new challenge, there is a clever solution. One of those clever solutions is Lock striping. It refers to an arrangement where locking occurs on multiple buckets or 'stripes'. 16 | 17 | Are you curious about, the challenge that we faced, which solutions we considered, and what was our final solution? Read on 😀. 18 | 19 | ## Background 20 | Databases must be able to import data quickly and reliably while maintaining data integrity and reducing time overhead. Weaviate is no exception to this! Given that our users populate Weaviate with hundreds of millions of data objects (if not more), we appreciate that import performance is of the highest ... *import-ance* (sorry) 🥁. 21 | 22 | Weaviate offers and strongly recommends the [batch import feature](/developers/weaviate/tutorials/import#import-setup) for adding data objects in bulk. To further speed up the import process, you can use parallelization, which lets you run multiple batches concurrently. Each object in these batches is then checked for duplicates and assigned a unique internal DocID used by Weaviate to access objects. 23 | 24 | We uncovered that there could be a race condition in this process. Sometimes when multiple batches contained identical objects with the same UUID, they could be added more than once to Weaviate, each time with different DocIDs. This, in turn, could cause issues within Weaviate. 25 | 26 | Luckily, we've addressed this issue without sacrificing performance (yay!🥳). Here's our journey that got us to the current solution. 27 | 28 | ## Our initial solutions 29 | In the initial solution, we added a lock (sync.Mutex in Go), so that now only a single goroutine can hold the lock, check for duplicate UUIDs, and assign DocIDs. This lock makes sure that the race does not occur anymore, but as an unintended side-effect the import time increased by ~20% due to lock-congestion. 30 | 31 | Upon further consideration, our team concluded that while using a single lock is effective, it's also overkill. Almost all objects are unique and it is not a problem to process those concurrently. We found that what we really needed was just a lock for each unique UUID. Cleverly, this approach would ensure that only one object per UUID is handled at each point in time, so that Weaviate cannot add multiple instances of objects with the same UUID. Meanwhile, it would still allow full parallelization of import processes to maximize performance. 32 | 33 | ![Single-lock solution](./img/single-lock-solution.png) 34 | 35 | As it often happens, implementing a lock-per-key solution created a different issue. Due to the large dataset size mentioned earlier, there can be millions or even billions of objects with unique UUIDs in Weaviate, and creating a lock for each of them would require a lot of memory. We found an elegant solution that is in-between both of the solutions above - a **lock striping** pattern. 36 | 37 | ## Solving both challenges 38 | Based on the UUID we assign each object to one of the 128 locks. This process is deterministic so objects with an identical UUID will always use the same lock. This gives us the best of both worlds: we have a small, fixed number of locks, but it still guarantees that two objects with the same UUID are never processed concurrently. With 128 locks, we only have 1/128th of the congestion of a single lock while still only using 128 * 8B = 1KB of memory. With the **lock striping** pattern, the import time is the same as without a lock, and we fixed the race condition without any negative performance impact. 39 | 40 | ![lock striping solution](./img/lock-striping-solution.png) 41 | 42 | We are very pleased to introduce this solution, which should eliminate the above issues that can be caused by data duplication at import. Additionally, we are also very happy to have arrived at a solution that comes with no data import performance penalty, having seen the mammoth datasets that our users often deal with. 43 | 44 | ## Update Weaviate 45 | The **lock striping** pattern was introduced in Weaviate `v1.15.4`. So if you are a Weaviate user, we encourage you to update Weaviate to the latest release to take advantage of this improvement as well as many others. 46 | 47 | Thank you for reading, and see you next time! 48 | 49 | 50 | import WhatNext from '/_includes/what-next.mdx' 51 | 52 | 53 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/data/2022-11-01-weaviate-1-16-release/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Weaviate 1.16 release 3 | slug: weaviate-1-16-release 4 | authors: [connor, jp, erika, sebastian, zain] 5 | date: 2022-11-01 6 | tags: ['release'] 7 | image: ./img/hero.png 8 | description: "Weaviate 1.16 introduces New Filter Operators, Distributed Backups, Centroid Module, Node Status API, Azure-based OIDC, and more. Lear all about it." 9 | --- 10 | 11 | import Core116 from './_core-1-16-include.mdx' ; 12 | 13 | 14 | 15 | import WhatsNext from '/_includes/what-next.mdx' 16 | 17 | 18 | 19 | import Ending from '/_includes/blog-end-oss-comment.md' ; 20 | 21 | 22 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/data/2022-12-20-weaviate-1-17-release/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Weaviate 1.17 release 3 | slug: weaviate-1-17-release 4 | authors: [erika, zain, laura, dan] 5 | date: 2022-12-20 6 | tags: ['release'] 7 | image: ./img/hero.png 8 | description: "Weaviate 1.17 introduces Replication, Hybrid Search, BM25, Faster Startup and Imports and more. Learn all about it." 9 | --- 10 | 11 | import Core117 from './_core-1-17-include.mdx' ; 12 | 13 | 14 | 15 | import WhatsNext from '/_includes/what-next.mdx' 16 | 17 | 18 | 19 | import Ending from '/_includes/blog-end-oss-comment.md' ; 20 | 21 | 22 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/data/2023-03-07-weaviate-1-18-release/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Weaviate 1.18 release 3 | slug: weaviate-1-18-release 4 | authors: [jp, erika, zain, dan] 5 | date: 2023-03-07 6 | tags: ['release'] 7 | image: ./img/hero.png 8 | description: "Weaviate 1.18 introduces Faster Filtering through Bitmap Indexing, HNSW-PQ, Cursor API, and more! Learn all about it." 9 | --- 10 | 11 | import Core118 from './_core-1-18-include.mdx' ; 12 | 13 | 14 | 15 | import WhatsNext from '/_includes/what-next.mdx' 16 | 17 | 18 | 19 | import Ending from '/_includes/blog-end-oss-comment.md' ; 20 | 21 | 22 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/data/2023-04-25-auth-in-weaviate/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Authentication in Weaviate (videos) 3 | slug: authentication-in-weaviate 4 | authors: [jp] 5 | date: 2023-04-25 6 | image: ./img/hero.png 7 | tags: ['concepts'] 8 | description: "Videos on authentication: an overview, how to log in, how to set it up, and core concepts - including recommendations." 9 | 10 | --- 11 | 12 | ![Authentication in Weaviate](./img/hero.png) 13 | 14 | 15 | 16 | import ReactPlayer from 'react-player/lazy' 17 | 18 | ## Overview 19 | 20 | Authentication is one of those topics that we get quite a few questions about. And we can see why. It's a big, complex topic, and even within Weaviate, there are many options available which can make it seem quite confusing. 21 | 22 | The core concept of authentication is relatively simple. When a client (e.g. a Weaviate client) sends a request to a server (e.g. a Weaviate database), it includes a "secret" that provides some assurances to Weaviate as to who that request is coming from, so that it can operate on that information. 23 | 24 | ![Conceptual diagram of sending a request with authentication credentials](./img/auth_light.png#gh-light-mode-only) 25 | ![Conceptual diagram of sending a request with authentication credentials](./img/auth_dark.png#gh-dark-mode-only) 26 | 27 | In other words, the server can provide as much access as the particular user is allowed. 28 | 29 | But balancing security with usability can be a tricky line to draw, as everybody has different needs and often use different systems. 30 | 31 | So, we thought that this might be a good time to provide an overview of all things authentication in Weaviate. Also, we've recently introduced an API key-based authentication method, which we think might be a good balance of security and usability for many of you. Please check them out below. 32 | 33 | :::infoEach video is only 3-6 minutes, and you do *not* need to watch them in order. 34 | ::: 35 | 36 | :::note Tell us what you think! 37 | We would love to know what you think of video content. Would you like to see more of them? Are there any particular types of videos you'd like more of? 38 | 39 | Please let us know below or on YouTube, and we'll do our best to listen. 😁 40 | ::: 41 | 42 | ## Videos 43 | 44 | ### Introduction to authentication in Weaviate 45 | 46 | 47 |
48 | 49 | #### Timestamps 50 | 51 | - 0:00 Overview 52 | - 0:13 What is authentication? & Key considerations 53 | - 0:58 Overview of available authentication options in Weaviate (anonymous / API key authentication / OIDC authentication) 54 | - 1:54 General Recommendations 55 | 56 | ### Authentication: A client-side perspective 57 | 58 | 59 |
60 | 61 | #### Timestamps 62 | 63 | - 0:00 Overview 64 | - 0:28 Getting authentication information from WCS 65 | - 2:10 Authenticating against Weaviate 66 | - 2:28 Anonymous access 67 | - 3:01 API key authentication 68 | - 3:45 OIDC (username+password) authentication 69 | - 4:21 Read-only key 70 | - 4:38 Authentication in action 71 | - 5:36 Wrap-up 72 | 73 | ### Authentication: Key concepts 74 | 75 | 76 |
77 | 78 | #### Timestamps 79 | 80 | - 0:00 Overview 81 | - 0:31 Anonymous access 82 | - 0:46 Authentication 83 | - 0:58 API key authentication 84 | - 1:04 OIDC authentication 85 | - 1:36 Authentication & Authorization 86 | - 1:52 A comparison of options 87 | - 2:09 Additional complexities in OIDC 88 | - 2:54 summary 89 | 90 | ### Authentication: A server-side perspective 91 | 92 | 93 |
94 | 95 | #### Timestamps 96 | 97 | - 0:00 Overview 98 | - 0:35 Weaviate without authentication 99 | - 1:39 Setting up API key access 100 | - 2:32 Enabling authorization (tiered access) 101 | - 3:46 Setting up OIDC access 102 | - 5:30 Enabling authorization with OIDC 103 | - 5:54 Summary 104 | - 6:02 Relevant environment variables 105 | 106 | ## Read more: 107 | 108 | - [How to configure authentication](/developers/weaviate/configuration/authentication) 109 | - [How to configure authorization](/developers/weaviate/configuration/authorization) 110 | - [References: Environment variables](/developers/weaviate/config-refs/env-vars) 111 | - [Weaviate clients](/developers/weaviate/client-libraries/) 112 | 113 | import WhatNext from '/_includes/what-next.mdx' 114 | 115 | 116 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/data/2023-05-02-wcs-public-beta/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Weaviate Cloud Service Public Beta - Open Now! 3 | slug: wcs-public-beta 4 | authors: [pete] 5 | date: 2023-05-02 6 | image: ./img/hero.png 7 | tags: ['release'] 8 | description: "The Weaviate Cloud Service is the easiest way to get a Weaviate cluster up and running within minutes. Learn more here." 9 | 10 | --- 11 | ![Weaviate Cloud Service Public Beta - Open Now!](./img/hero.png) 12 | 13 | 14 | 15 | import ReactPlayer from 'react-player/lazy' 16 | 17 | Last November, we quietly introduced the private beta of the [Weaviate Cloud Service](https://weaviate.io/pricing), a fully managed [vector database](https://weaviate.io/blog/what-is-a-vector-database) as a service. Today we are announcing a big upgrade to the Weaviate Cloud and availability of the public beta release of the service. 18 | 19 | 20 | 21 | The Weaviate Cloud enables AI application developers to use the [open source Weaviate vector database](https://weaviate.io/developers/weaviate) as a fully managed cloud service. It’s the easiest way to get a vector database cluster up and running within minutes, so you can get right to loading, vectorizing, and searching your data. 22 | 23 | ## Thanks for all the early feedback! 24 | 25 | During the Weaviate Cloud private beta, we had several thousand people create free Weaviate Cloud sandboxes and try it out. We’d like to thank everyone who tried it and gave us feedback; it was extremely helpful. We look forward to hearing about your experience with the new (and future versions), which you can still [try for free here](https://console.weaviate.cloud/). 26 | 27 | ## The Weaviate Cloud Service Public Beta 28 | Here’s a quick overview of what’s new and what’s coming next. 29 | 30 | ### Help yourself - Self-Service Provisioning Improvements 31 | One of the biggest changes from the private beta to today’s public beta release is automated Weviate database cluster provisioning. Immediately after signing up for a Weaviate Cloud account, you can begin creating, querying, securing, and controlling one or more databases via the Weaviate Cloud console. As a result of the automation improvements, newly created Weaviate database clusters will be ready for use within a minute or two. 32 | 33 | ![Weaviate Cloud Service Create Cluster Page ](./img/wcs-options.png) 34 | 35 | ### Weaviate Cloud Service runs on Google Cloud (other clouds & on-premises are options too) 36 | The Weaviate Cloud Service runs on Google Cloud, and by default, new Weaviate database clusters are provisioned to run on Google Cloud. When you create a new cluster, you can choose a specific Google Cloud location (region) on which to run your database cluster. We do plan to make Weaviate Cloud available on AWS and Azure; stay tuned for news on that! 37 | 38 | ### Hybrid SaaS Option - Fully Managed, on Your Cloud 39 | If you’d like your database hosted on a dedicated private cloud, you can contact us and [request a Hybrid-SaaS cluster](https://weaviate.io/pricing). With the Hybrid-SaaS option, Weaviate will set up and manage your database cluster on a dedicated private cloud system on the cloud platform of your choice or on premises in your data center. 40 | 41 | ## The Full Power of the Weaviate Vector Database 42 | The Weaviate Cloud is always updated with the latest [Weaviate open source database](https://github.com/weaviate/weaviate) version and functionality. If you’ve been using Weaviate Cloud since its release, you’ve seen it enhanced with new core Weaviate database functionality, such as: 43 | 44 | - [ChatGPT plug-in](https://weaviate.io/blog/weaviate-retrieval-plugin) 45 | - [Bitmap indexing](https://weaviate.io/blog/weaviate-1-18-release#faster-filtering-with-roaring-bitmaps) for faster filtered search 46 | - [HNSW-PQ index and data compression](https://weaviate.io/blog/weaviate-1-18-release#hnsw-pq) for greater cost efficiency 47 | - [Database replication](https://weaviate.io/blog/weaviate-1-18-release#replication) 48 | - [WAND and BM25 search](https://weaviate.io/blog/weaviate-1-18-release#improvements-to-bm25-and-hybrid-search) 49 | - [Cursor API](https://weaviate.io/blog/weaviate-1-18-release#cursor-api) for processing query results 50 | 51 | ## Develop More Productively - Interactive Admin & Query Console 52 | We care a lot about the Weaviate user experience, so developer productivity is a top design priority. Hence, we implemented many new features in the Weaviate Cloud Console, which now allows you to administer your Weaviate clusters - create, delete, restore, monitor your clusters and activate high-availability settings. 53 | 54 | ![Weaviate Cloud Service Console ](./img/wcs-connected-instances.png) 55 | 56 | The console also features a GraphQL IDE that allows you to interactively query your Weaviate databases. The GraphQL query editor features: 57 | 58 | - Syntax highlighting 59 | - Intelligent type ahead of fields, arguments, types, and more 60 | - Real-time error highlighting and reporting for queries and variables 61 | - Automatic query and variables completion 62 | 63 | 64 | ![Weaviate Cloud Service GraphQL IDE ](./img/wcs-console-example-query.png) 65 | 66 | ## Control Access to Weaviate - API Key Management 67 | To help make it easy to control access to your vector databases, all Weaviate Cloud instances can generate API keys with full admin (read and write) access. Read-only API keys are also supported for paid clusters. 68 | 69 | 70 | ![API Key Management in Weaviate Cloud Service](./img/wcs-get-key.png) 71 | 72 | ## Next Stop, GA… 73 | The Weaviate Cloud is in public beta. General Availability is planned for release later in 2023, after we’ve addressed feedback from public beta users. 74 | 75 | If you’d like to try Weaviate Cloud, you can create a [free Weaviate Cloud Sandbox here](https://console.weaviate.cloud/). 76 | 77 | And if you have questions or feedback, please join the [Weaviate community on Slack](https://weaviate.io/slack). We look forward to hearing from you! 78 | 79 | import WhatNext from '/_includes/what-next.mdx' 80 | 81 | 82 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/data/2023-05-04-weaviate-1-19-release/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Weaviate 1.19 Release 3 | slug: weaviate-1-19-release 4 | authors: [jp,zain,erika] 5 | date: 2023-05-04 6 | image: ./img/hero.png 7 | tags: ['release'] 8 | description: "Weaviate 1.19 introduces generative cohere module, gRPC API support, improved data types, and more." 9 | 10 | --- 11 | 12 | import Core119 from './_core-1-19-include.mdx' ; 13 | 14 | 15 | 16 | import WhatsNext from '/_includes/what-next.mdx' 17 | 18 | 19 | 20 | import Ending from '/_includes/blog-end-oss-comment.md' ; 21 | 22 | 23 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/data/2023-05-10-announcing-palm-modules/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Try Google's newly announced PaLM API with Weaviate 3 | slug: announcing-palm-modules 4 | authors: [jp] 5 | date: 2023-05-10 6 | image: ./img/hero.png 7 | tags: ['integrations'] 8 | description: "Weaviate now supports the PaLM models for embeddings and generative search through two new modules." 9 | 10 | --- 11 | 12 | ![Weaviate v1.19.1 introduces modules for use with Google's Vertex PALM API](./img/hero.png) 13 | 14 | 15 | 16 | We are thrilled to announce two brand new Weaviate modules that will help you to get the most out Google's new PaLM large language model (LLM). 17 | 18 | 19 | 22 | 23 | These new modules are: 24 | - [`text2vec-palm`](/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-palm) for generating vector embeddings and running semantic (`nearText`) queries, and 25 | - [`generative-palm`](/developers/weaviate/modules/reader-generator-modules/generative-palm) for generative search. 26 | 27 | 28 | These modules are available to all Weaviate users as of **today**, with the release of Weaviate version `v1.19.1`. They integrate the new Vertex PaLM API with Weaviate, allowing you to hit the ground running straight away with the latest in LLM and [vector database](https://weaviate.io/blog/what-is-a-vector-database) technologies. 29 | 30 | ## What is PaLM? 31 | 32 | The Pathways Language Model (or `PaLM`) is Google’s own LLM. According to Google, PaLM was designed to generalize across domains and tasks while being highly efficient. 33 | 34 | You can read more about in [this blog](https://ai.googleblog.com/2022/04/pathways-language-model-palm-scaling-to.html) or [this paper](https://arxiv.org/abs/2204.02311), but some of the highlights from these articles are that PaLM: 35 | - Contains 540-billion 🤯 parameters, 36 | - Is a dense decoder-only Transformer model, and 37 | - Was trained using a combination of English and multilingual datasets. 38 | 39 | Don't take our word for it - take a look at these [demo snippets from Google's blog](https://ai.googleblog.com/2022/04/pathways-language-model-palm-scaling-to.html). 40 | 41 | ![Image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLmQjS3gOQ2x7ru3xovYjVw-Yr2fKDCqhDHByQZitD92Yu4L-v2BBa5f_VMfpWM4D0930Dmk35EY1TqGrYUtMQqJO41hkLqXuu51eOpXZ3PvYPSjf5stfEJNJn2idWnRYCCEgBiJuLDTXX5Fgt-Mk13kCKdO12JShGvDO_cArtLKv8U8obJaHiL5ASQg/s16000/Big%20Bench%20Sped%20Up%20Cropped.gif) 42 | 43 | > Edit: We now have more details on the PaLM 2 family of models, which the API is based on! [Read about it here](https://blog.google/technology/ai/google-palm-2-ai-large-language-model/). In the blog, Google especially highlights improvements in multilingual, reasoning and coding capabilities. 44 | 45 | ### What can the Vertex PaLM API do? 46 | 47 | Being an LLM, PaLM can perform numerous tasks, from question-answering, sentence-completion, reading comprehension tasks, common-sense reasoning tasks and more. 48 | 49 | Additionally, it can perform multi-lingual NLP tasks reflecting its dataset. What's more, you can use Google's Vertex AI PaLM API to test, customize, and deploy instances of Google's LLMs. 50 | 51 | In other words, you can not only use PaLM off-the-shelf, but also customize the foundation model to suit **your** needs. 52 | 53 | ## PaLM Weaviate 54 | 55 | ![You can use Weaviate with the Vertex PALM API](./img/highlight.png) 56 | 57 | And we are excited to tell you about the ['text2vec-palm`](/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-palm) and ['generative-palm'](/developers/weaviate/modules/reader-generator-modules/generative-palm) modules. These modules will help you to bring the power of the newest LLM on the block to the, *ahem*, `PaLM` of your hand - or at least, to your Weaviate instance. 58 | 59 | ### Embeddings with `text2vec-palm` 60 | 61 | The [`text2vec-palm`](/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-palm) module can use a PaLM model to convert text to vector embeddings that represent their meaning. 62 | 63 | So, you can use the `text2vec-palm` module to build a Weaviate database using PaLM-derived vectors for text objects, and perform lightning-fast searches. 64 | 65 | The PaLM model used, `textembedding-gecko-001`, takes a maximum of 3,072 input tokens, and outputs 768-dimensional vector embeddings. 66 | 67 | Please note that according to Google, the embedding endpoint does *not* support fine-tuning. 68 | 69 | ### Generative search with `generative-palm` 70 | 71 | The [`generative-palm`](/developers/weaviate/modules/reader-generator-modules/generative-palm) module is another exciting development for Weaviate and Google Cloud / Vertex AI users. 72 | 73 | Our generative search modules work in two stages. First, a search is performed in Weaviate, and then a generative model such as PaLM is called to action, whereby the results are sent to prompt the LLM (PaLM in this case). 74 | 75 | In other words - Weaviate can not only find the right data object for you, it can find it, and send it to PaLM to answer questions about it, expand upon it, summarize it, or otherwise transform it as you see fit. 76 | 77 | And remember that the Vertex PaLM API allows further fine-tuning of your PaLM model? It means you can do all this with an LLM that has been tuned to your use case, such as your task, or domain. 78 | 79 | The base PaLM model for generative search is `text-bison-001`, which has the following properties: 80 | 81 | - Max input token: 8,192 82 | - Max output tokens: 1,024 83 | - Training data: Up to Feb 2023 84 | 85 | ## Want to try it out? 86 | 87 | You can read more about how to use these modules in our documentation! See the pages for: 88 | 89 | - [`text2vec-palm`](/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-palm), and 90 | - [`generative-palm`](/developers/weaviate/modules/reader-generator-modules/generative-palm). 91 | 92 | import WhatNext from '/_includes/what-next.mdx' 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/data/2023-06-06-embedded-weaviate/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: How to run an embedded vector database in 10 lines of code 3 | slug: embedded-local-weaviate 4 | authors: [dan] 5 | date: 2023-06-06 6 | image: ./img/hero.png 7 | tags: ['how-to'] 8 | description: "The Weaviate server can be run locally directly from client code" 9 | 10 | --- 11 | 12 | import Tabs from '@theme/Tabs'; 13 | import TabItem from '@theme/TabItem'; 14 | import FilteredTextBlock from '@site/src/components/Documentation/FilteredTextBlock'; 15 | import PyCode from '!!raw-loader!/_includes/code/embedded.py'; 16 | import TSCode from '!!raw-loader!/_includes/code/embedded.ts'; 17 | 18 | Yes, 10 Python lines of code, generously formatted with whitespace. Or 14 for TypeScript. Oh, and all your data stays private locally, and we don't charge you anything. We're also going to build a useful example, illustrating a testing scenario. Here's how. 19 | 20 | 21 | 22 | 23 | ## 1. Install the client library 24 | 25 | The Python and TypeScript client libraries support running Weaviate embedded on Linux, and starting with versions 3.21.0 and 1.2.0 respectively, on macOS as well. 26 | 27 | 28 | 29 | 30 | ```bash 31 | pip install weaviate-client --upgrade 32 | ``` 33 | 34 | 35 | 36 | 37 | 38 | ```bash 39 | npm install weaviate-ts-embedded typescript ts-node jest # also install support for TypeScript and Jest testing 40 | ``` 41 | 42 | 43 | 44 | 45 | 46 | ## 2. Run the code 47 | 48 | 49 | 50 | 51 | Save as `embedded.py` and run `python embedded.py`: 52 |
53 | 54 | 60 |
61 | 62 | 63 | 64 | Save as `embedded.ts` and run `node --loader=ts-node/esm embedded.ts`: 65 |
66 | 67 | 73 |
74 |
75 | 76 | 77 | ## How does this work? 78 | 79 | Essentially, what happens behind the scenes is that the client library downloads the server binary, spawns it in a separate process, connects to it, then terminates it on exit. The data is persisted, so you can use it from future invocations, or you can [transfer it to another instance](/developers/weaviate/manage-data/read-all-objects/#restore-to-a-target-instance). 80 | 81 | You can learn more about running Weaviate locally from client code on the [Embedded Weaviate](/developers/weaviate/installation/embedded/) page. 82 | 83 | 84 | ## Use cases 85 | 86 | What can you do with Embedded Weaviate? Quite a few things! 87 | 88 | First off, you can get started very quickly with Weaviate on your local machine, without having to explicitly download, install or instantiate a server. 89 | 90 | 91 | ### Jupyter notebooks 92 | 93 | You can also use Embedded Weaviate from Jupyter notebooks, including on Google Colaboratory. Here is the example above as [Google Colab notebook](https://colab.research.google.com/drive/1XAJc9OvkKhsJRmheqWZmjYU707dqEIl8?usp=sharing). 94 | 95 | ![Colab screenshot](./img/colab.png) 96 | 97 | ### Use Weaviate in CI/CD pipelines 98 | 99 | You can use Embedded Weaviate in automated tests, where you can run integration tests without having to manage a separate server instance. Here is the example above slightly modified to perform similarity search and test that the added object was found. 100 | 101 | 102 | 103 | 104 | Save as `embedded_test.py` and run `pytest`. (If you don't have pytest, run `pip install pytest`.) 105 |
106 | 107 | 113 |
114 | 115 | 116 | 117 | Save as `embedded_test.ts` and run `npx jest`: 118 |
119 | 120 | 126 |
127 |
128 | 129 | 130 | Have you found other use cases for embedded Weaviate? Let us know in the comments below! 131 | 132 | 133 | import WhatNext from '/_includes/what-next.mdx' 134 | 135 | 136 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/data/2023-07-11-weaviate-1-20-release/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Weaviate 1.20 Release 3 | slug: weaviate-1-20-release 4 | authors: [dan,erika,jp,zain] 5 | date: 2023-07-11 6 | image: ./img/hero.png 7 | tags: ['release', 'engineering'] 8 | description: "Weaviate 1.20 released with multi-tenancy, PQ, search re-ranking, autocut, hybrid fusion algorithm ... take a look!" 9 | 10 | --- 11 | 12 | import Core120 from './_core-1-20-include.mdx' ; 13 | 14 | 15 | 16 | import WhatsNext from '/_includes/what-next.mdx' 17 | 18 | 19 | 20 | import Ending from '/_includes/blog-end-oss-comment.md' ; 21 | 22 | 23 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/data/2023-08-22-weaviate-1-21-release/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Weaviate 1.21 Release 3 | slug: weaviate-1-21-release 4 | authors: [jp, zain] 5 | date: 2023-08-22 6 | image: ./img/hero.png 7 | tags: ['release', 'engineering'] 8 | description: "Weaviate 1.21 released with new operators, performance improvements, multi-tenancy improvements, and more!" 9 | 10 | --- 11 | 12 | import Core121 from './_core-1-21-include.mdx' ; 13 | 14 | 15 | 16 | import WhatsNext from '/_includes/what-next.mdx' 17 | 18 | 19 | 20 | import Ending from '/_includes/blog-end-oss-comment.md' ; 21 | 22 | 23 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/data/2023-10-31-weaviate-1-22-release/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Weaviate 1.22 Release 3 | slug: weaviate-1-22-release 4 | authors: [jp] 5 | date: 2023-10-23 6 | image: ./img/hero.png 7 | tags: ['release', 'engineering'] 8 | description: "Weaviate 1.22 released with nest object storage, async indexing, further gRPC support, and more!" 9 | 10 | --- 11 | 12 | import Core122 from './_core-1-22-include.mdx' ; 13 | 14 | 15 | 16 | import WhatsNext from '/_includes/what-next.mdx' 17 | 18 | 19 | 20 | import Ending from '/_includes/blog-end-oss-comment.md' ; 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/data/2023-11-15-moonsift-story/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Building an AI-Powered Shopping Copilot with Weaviate 3 | slug: moonsift-story 4 | authors: [alea, zain] 5 | date: 2023-11-15 6 | tags: [] 7 | image: ./img/hero.png 8 | description: "UK-based startup Moonsift is harnessing the power of AI with Weaviate." 9 | --- 10 | ![hero](img/hero.png) 11 | 12 | UK-based startup Moonsift is harnessing the power of AI—using machine learning models and Weaviate’s vector database—to help online shoppers discover the products they love. 13 | 14 | 15 | 16 | [Moonsift](https://www.moonsift.com/) offers an ecommerce browser extension for users to curate shoppable boards with products from across the internet. Stylists and curators use Moonsift to create collections, registries, and wish lists that can be shared and shopped with a simple link. While thousands of customers add products from tens of thousands of retailers per month to Moonsift, co-founders David Wood and Alex Reed have a bigger vision for improving product discoverability for online shoppers. 17 | 18 | With combined experience in natural language processing (NLP), data science, and consulting for retail brands, Wood and Reed saw how retailers unknowingly restrict their own discoverability by tailoring keywords for search engines rather than users. How even with the most illustrious descriptions, shoppers struggle to find the products they’re looking for. They knew that retail discoverability wasn’t what it could be, and built Moonsift to improve it. 19 | 20 | > From the beginning, Wood and Reed’s vision was to use the power of AI to help shoppers more easily discover the products they love. 21 | 22 | ## Collecting data to enable understanding 23 | The first generation of Moonsift has been a stepping stone toward this vision. In order to create a comprehensive AI shopping copilot, they needed product data from retailers along with cross-retailer shopping data to enable understanding of the discovery process and train machine learning models. And that’s exactly what they’ve been collecting. Usage of their browser extension over the last few years has enabled Moonsift to explore discovery and train models on over 60M products, 250M interactions, and 40K retailers across the internet. Now, Moonsift has the data they need (which is growing every day) to improve product discovery with AI. 24 | 25 | ## Building the discovery engine 26 | The Moonsift team brought on Marcel Marais as lead machine learning engineer to build a system that could harness the data they’ve gathered to take their product to the next level. At first, Marais looked at improving discovery through a keyword-based search system using BM25 and re-ranking, but he quickly assessed that would not be sufficient to power the type of recommendation engine they needed. He needed to implement semantic search, a system that could interpret a user’s intent rather than rely on exact keyword matches. And they needed a system that could index and search multimodal (text and image) data across millions of objects. Based on prior experience with semantic search and vector embeddings, Marais decided a vector database was the tool for the job. 27 | 28 | Marais quickly put together a checklist of priorities for their vector database selection. Moving fast was important, so ease of use was at the top of the list. The company preferred an open source platform, and since they would be indexing millions of products, they needed a solution that was both high-performing and cost-efficient at scale. 29 | 30 | ## Selecting Weaviate as the vector database of choice 31 | After a thorough evaluation of a handful of open and closed-source vector databases, the team decided that Weaviate was the best-fit solution for their needs. 32 | 33 | They cited the following reasons for choosing Weaviate: 34 | 35 | * Open source, with an active community and managed cloud offering. 36 | * Comprehensive documentation and strong support for popular LLMs and multi-modal models. 37 | * Direct integration of machine learning models using a module system, with the ability to easily swap out and experiment with different models. 38 | * Advanced monitoring and replication capabilities. 39 | * High query throughput at scale. 40 | * Unique search features to drive performance and efficiency (using important aspects of both keyword and vector search). 41 | 42 | > “Weaviate was exactly what we needed. Within a couple of weeks we had a production-ready AI-powered search engine. We’re confident in knowing we don’t have to trade performance for scale.” 43 | 44 | – David Wood, CTO and co-founder, Moonsift 45 | 46 | ## Next steps 47 | Moonsift is now getting ready to launch their [AI Copilot](https://www.moonsift.com/copilot) to the world. They’re seeing early results of the power of its ability to understand user intent and serve intelligent results. Some fun examples include “shirt that looks like a Caipirinha” or “skirt with a pattern inspired by ocean waves”. 48 | 49 | ![image](img/image1.png) 50 | 51 | As Moonsift prepares for the public launch of its shopping Copilot, the team is continuing to explore ways to optimize the cost, performance, and scale of their system. They are looking into Weaviate’s new feature, [Product Quantization (PQ)](/blog/pq-rescoring), which helps reduce the memory footprint of their system, by compressing vectors and performing rescoring, while retaining search relevance. Along with PQ they are also exploring [multi-tenancy](/blog/multi-tenancy-vector-search) that will allow them to scale and perform personalized vector search for millions of customers. 52 | 53 | 54 | [See a demo](https://www.youtube.com/watch?v=hOsBxvV9rvI) of Moonsift’s shopping Copilot, and [sign up for early access today](https://www.moonsift.com/copilot)! 55 | 56 | 57 | ## What's next 58 | Interested in using Weaviate to power your search and AI applications? [Give our fully managed cloud offering a spin](https://console.weaviate.cloud/) for free and check out our [Quickstart guide](/developers/weaviate/quickstart). 59 | 60 | You can reach out to us on [Slack](https://weaviate.io/slack) or [Twitter](https://twitter.com/weaviate_io), or [join the community forum](https://forum.weaviate.io/). 61 | 62 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/data/2023-12-19-weaviate-1-23-release/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Weaviate 1.23 Release 3 | slug: weaviate-1-23-release 4 | authors: [jp, dave] 5 | date: 2023-12-19 6 | image: ./img/hero.png 7 | tags: ['release', 'engineering'] 8 | description: "Weaviate 1.23 released with AutoPQ, flat indexing + Binary Quantization, OSS LLM support through Anyscale, and more!" 9 | 10 | --- 11 | 12 | import Core123 from './_core-1-23-include.mdx' ; 13 | 14 | 15 | 16 | import WhatsNext from '/_includes/what-next.mdx' 17 | 18 | 19 | 20 | import Ending from '/_includes/blog-end-oss-comment.md' ; 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/archived-issues/readme.md: -------------------------------------------------------------------------------- 1 | ### Answers to issues opened related to recipes/integrations/dspy 2 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/community.md: -------------------------------------------------------------------------------- 1 | # Community Sourced Resources to Learn about DSPy! 2 | 3 | Please note, this is still very early on! Please open a PR with any missing resources! 4 | 5 | Resources are sorted alphabetically to avoid bias in presentation order. 6 | 7 | ## Blogs 8 | 9 | [DSPy by Chris Levy](https://drchrislevy.github.io/posts/dspy/dspy.html) 10 | 11 | [DSPy: Revolutionizing Complex System Development with Language Models by Fearnworks](https://fearnworks.github.io/blog/_pages/2024-02-12-DSPyForComplexSystemDevelopment.html) 12 | 13 | ## Examples 14 | 15 | [DSPy Examples](https://github.com/stanfordnlp/dspy/tree/main/examples) 16 | 17 | [Self-Discover by Chris Dossman](https://colab.research.google.com/drive/1GkAQKmw1XQgg5UNzzy8OncRe79V6pADB?usp=sharing) 18 | 19 | [Synthetic Data Generation by Franck SN](https://twitter.com/ndzfs/status/1764249868347072845) 20 | 21 | [Typed Signatures by Thomas Ahle](https://github.com/stanfordnlp/dspy/blob/main/examples/functional/functional.ipynb) 22 | 23 | ## Papers 24 | 25 | [Assisting in Writing Wikipedia-like Articles from Scratch with Large Language Models, Shao et al. 2024.](https://arxiv.org/abs/2402.14207) 26 | 27 | [DSPy Assertions: Computational Constraints for Self-Refining Language Model Pipelines, Singhvi et al. 2024.](https://arxiv.org/abs/2312.13382) 28 | 29 | [DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines, Khattab et al. 2023.](https://arxiv.org/abs/2310.03714) 30 | 31 | [The Unreasonable Effectiveness of Eccentric Automatic Prompts, Battle and Gollapudi, 2024.](https://arxiv.org/abs/2402.10949) 32 | 33 | ## Podcasts 34 | 35 | ## Projects 36 | 37 | [DSPyGen by Sean Chatman](https://github.com/seanchatmangpt/dspygen/tree/main) 38 | 39 | ## Pull Requests 40 | 41 | [#530 - Synthetic Data Generation by Herumb Shandilya](https://github.com/stanfordnlp/dspy/pull/530) 42 | 43 | ## Resource Repos 44 | 45 | [Awesome-DSPy](https://github.com/ganarajpr/awesome-dspy) 46 | 47 | ## Videos 48 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/docker-compose.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3.4' 3 | services: 4 | weaviate: 5 | command: 6 | - --host 7 | - 0.0.0.0 8 | - --port 9 | - '8080' 10 | - --scheme 11 | - http 12 | image: semitechnologies/weaviate:1.24 13 | ports: 14 | - 8080:8080 15 | - 50051:50051 16 | restart: on-failure:0 17 | environment: 18 | COHERE_APIKEY: $COHERE_APIKEY 19 | QUERY_DEFAULTS_LIMIT: 25 20 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 21 | PERSISTENCE_DATA_PATH: '/var/lib/weaviate' 22 | DEFAULT_VECTORIZER_MODULE: 'text2vec-cohere' 23 | ENABLE_MODULES: 'text2vec-cohere' 24 | CLUSTER_HOSTNAME: 'node1' 25 | ... 26 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/dspy-and-you/readme.md: -------------------------------------------------------------------------------- 1 | # Using the You API with Weaviate! 2 | 3 | The You API is one of the easiest ways to retrieve from the internet! 4 | 5 | You can get started by grabbing an API key at https://api.you.com/api-key! 6 | 7 | We currently have a demo on RAG with You, Weaviate, and DSPy! Please let us know what else you want to see! 8 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/dspy_local_setup.md: -------------------------------------------------------------------------------- 1 | # Setup Local DSPy Development Environment 2 | 3 | Here are the steps needed to set up and manage a local build of DSPy project with Poetry, build a local version of the library, create a Jupyter notebook kernel, and update the environment when the local DSPy package changes. 4 | 5 | # Setting Up and Managing a Python Project with Poetry and Jupyter 6 | 7 | This guide walks you through setting up a Python project with Poetry, building a local version of a library, creating a Jupyter notebook kernel using this environment, and updating the environment when the local package changes. 8 | 9 | ## Prerequisites 10 | 11 | - Ensure you have Python installed (version 3.9 or later). 12 | - Install Poetry by running: 13 | 14 | ```bash 15 | curl -sSL https://install.python-poetry.org | python3 - 16 | ``` 17 | 18 | # Step 1: Initialize a Poetry Project 19 | Navigate to your project directory: 20 | 21 | ```bash 22 | cd path/to/dspy-dev 23 | ``` 24 | 25 | Initialize a new Poetry project: 26 | 27 | ```bash 28 | poetry init 29 | ``` 30 | 31 | Follow the prompts to set up your project, including naming it, specifying the version, description, etc. 32 | 33 | Edit the `pyproject.toml` file to include your local package: 34 | 35 | ```toml 36 | [tool.poetry] 37 | name = "dspy-dev" 38 | version = "0.1.0" 39 | description = "" 40 | authors = ["Your Name "] 41 | readme = "README.md" 42 | 43 | [tool.poetry.dependencies] 44 | python = ">=3.9,<3.13" 45 | dspy = { path = "./dspy" } 46 | 47 | [build-system] 48 | requires = ["poetry-core"] 49 | build-backend = "poetry.core.masonry.api" 50 | ``` 51 | 52 | # Step 2: Install Dependencies 53 | Install the dependencies and create a virtual environment: 54 | 55 | ```bash 56 | poetry install 57 | ``` 58 | 59 | # Step 3: Create a Jupyter Kernel 60 | 61 | ```bash 62 | poetry add jupyter ipykernel 63 | ``` 64 | 65 | Create a new Jupyter kernel: 66 | 67 | ```bash 68 | poetry run python -m ipykernel install --user --name dspy-dev --display-name "Python (dspy-dev)" 69 | ``` 70 | 71 | # Step 4: Launch Jupyter Notebook 72 | 73 | ```bash 74 | poetry run jupyter notebook 75 | ``` 76 | 77 | # Step 5: Select the New Kernel 78 | 79 | Open a new or existing notebook. 80 | Go to the kernel selection menu (Kernel -> Change kernel). 81 | Select "Python (dspy-env)". 82 | 83 | # Step 6: Update the Local Package 84 | 85 | When you make changes to the local package: 86 | 87 | Update the code in the `./dspy` directory as needed. 88 | 89 | Reinstall the package to ensure Poetry recognizes the changes: 90 | 91 | ```bash 92 | poetry install 93 | ``` 94 | 95 | In your Jupyter Notebook, click on Kernel -> Restart Kernel. 96 | 97 | By following these steps, you can efficiently manage your local DSPy build with Poetry, create a Jupyter Notebook kernel using the environment, and update the environment when the local package changes. 98 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/4.RAG-with-Persona.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# RAG with Persona" 8 | ] 9 | }, 10 | { 11 | "cell_type": "markdown", 12 | "metadata": {}, 13 | "source": [ 14 | "## Installation" 15 | ] 16 | }, 17 | { 18 | "cell_type": "code", 19 | "execution_count": null, 20 | "metadata": {}, 21 | "outputs": [], 22 | "source": [ 23 | "import dspy\n", 24 | "from dspy.retrieve.weaviate_rm import WeaviateRM\n", 25 | "import weaviate\n", 26 | "import cohere" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": {}, 32 | "source": [ 33 | "### Connect to Weaviate Instance and Configure Model" 34 | ] 35 | }, 36 | { 37 | "cell_type": "code", 38 | "execution_count": null, 39 | "metadata": {}, 40 | "outputs": [], 41 | "source": [ 42 | "cohere_key = \"API_KEY\"\n", 43 | "\n", 44 | "command_nightly = dspy.Cohere(model=\"command-nightly\",max_tokens=1000, api_key=cohere_key)\n", 45 | "\n", 46 | "weaviate_client = weaviate.Client(\"WEAVIATE_URL\")\n", 47 | "retriever_model = WeaviateRM(\"ChatMessage\", weaviate_client=weaviate_client)\n", 48 | "dspy.settings.configure(lm=command_nightly, rm=retriever_model)" 49 | ] 50 | }, 51 | { 52 | "cell_type": "markdown", 53 | "metadata": {}, 54 | "source": [ 55 | "## Configure Signature" 56 | ] 57 | }, 58 | { 59 | "cell_type": "code", 60 | "execution_count": null, 61 | "metadata": {}, 62 | "outputs": [], 63 | "source": [ 64 | "class AnswerWithPersona(dspy.Signature):\n", 65 | " \"\"\"\n", 66 | " Respond to the chat messages with a response consistent with the given persona.\n", 67 | " \"\"\"\n", 68 | "\n", 69 | " persona = dspy.InputField()\n", 70 | " message = dspy.InputField()\n", 71 | " message_contexts = dspy.InputField(desc=\"retrieved context relevant to the latest message.\")\n", 72 | " response = dspy.OutputField()" 73 | ] 74 | }, 75 | { 76 | "cell_type": "markdown", 77 | "metadata": {}, 78 | "source": [ 79 | "## Build Program" 80 | ] 81 | }, 82 | { 83 | "cell_type": "code", 84 | "execution_count": null, 85 | "metadata": {}, 86 | "outputs": [], 87 | "source": [ 88 | "class RAGwithPersona(dspy.Module):\n", 89 | " def __init__(self):\n", 90 | " super().__init__() \n", 91 | " self.retrieve = dspy.Retrieve(k=3)\n", 92 | " self.rag_with_persona = dspy.Predict(AnswerWithPersona)\n", 93 | " \n", 94 | "\n", 95 | " def forward(self, persona, message):\n", 96 | " message_contexts = self.retrieve(message).passages\n", 97 | " response = self.rag_with_persona(persona=persona, message=message, message_contexts=message_contexts).response\n", 98 | " return dspy.Prediction(response=response)\n", 99 | "\n", 100 | "program = RAGwithPersona()" 101 | ] 102 | }, 103 | { 104 | "cell_type": "markdown", 105 | "metadata": {}, 106 | "source": [ 107 | "## Try it out" 108 | ] 109 | }, 110 | { 111 | "cell_type": "code", 112 | "execution_count": null, 113 | "metadata": {}, 114 | "outputs": [], 115 | "source": [ 116 | "program(persona=\"You are Taylor Swift\", message=\"What will your new album be about?\")" 117 | ] 118 | }, 119 | { 120 | "cell_type": "code", 121 | "execution_count": null, 122 | "metadata": {}, 123 | "outputs": [], 124 | "source": [ 125 | "command_nightly.inspect_history(n=1)" 126 | ] 127 | }, 128 | { 129 | "cell_type": "markdown", 130 | "metadata": {}, 131 | "source": [ 132 | "## Store response in the database" 133 | ] 134 | }, 135 | { 136 | "cell_type": "code", 137 | "execution_count": null, 138 | "metadata": {}, 139 | "outputs": [], 140 | "source": [ 141 | "from weaviate.util import get_valid_uuid\n", 142 | "import uuid\n", 143 | "\n", 144 | "user_chat_id = get_valid_uuid(uuid4())\n", 145 | "chat_snippets.data.insert(\n", 146 | " properties={\n", 147 | " \"author\": \"user\",\n", 148 | " \"content\": parsed_history[-1]\n", 149 | " },\n", 150 | " uuid=user_chat_id\n", 151 | ")" 152 | ] 153 | } 154 | ], 155 | "metadata": { 156 | "kernelspec": { 157 | "display_name": "Python 3 (ipykernel)", 158 | "language": "python", 159 | "name": "python3" 160 | }, 161 | "language_info": { 162 | "codemirror_mode": { 163 | "name": "ipython", 164 | "version": 3 165 | }, 166 | "file_extension": ".py", 167 | "mimetype": "text/x-python", 168 | "name": "python", 169 | "nbconvert_exporter": "python", 170 | "pygments_lexer": "ipython3", 171 | "version": "3.11.6" 172 | } 173 | }, 174 | "nbformat": 4, 175 | "nbformat_minor": 2 176 | } 177 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/Create-Weaviate-Schema.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "id": "11ccd52f", 7 | "metadata": {}, 8 | "outputs": [], 9 | "source": [ 10 | "# Import Weaviate and Connect to Client\n", 11 | "import weaviate\n", 12 | "client = weaviate.connect_to_local()" 13 | ] 14 | }, 15 | { 16 | "cell_type": "code", 17 | "execution_count": 2, 18 | "id": "e8f1b7cd", 19 | "metadata": {}, 20 | "outputs": [ 21 | { 22 | "name": "stderr", 23 | "output_type": "stream", 24 | "text": [ 25 | "/var/folders/41/8dp_379x15d8zz4ppsjthdw40000gn/T/ipykernel_78743/1867762106.py:4: ResourceWarning: unclosed \n", 26 | " client = weaviate.connect_to_local()\n", 27 | "ResourceWarning: Enable tracemalloc to get the object allocation traceback\n" 28 | ] 29 | } 30 | ], 31 | "source": [ 32 | "import weaviate\n", 33 | "import weaviate.classes as wvc\n", 34 | "\n", 35 | "client = weaviate.connect_to_local()\n", 36 | "\n", 37 | "try:\n", 38 | " client.collections.create(\n", 39 | " name=\"ChatMessages\",\n", 40 | " description=\"Snippets from chats on RAGwithPersona.\",\n", 41 | " properties=[\n", 42 | " wvc.config.Property(\n", 43 | " data_type=wvc.config.DataType.TEXT,\n", 44 | " description=\"The text content of the chat snippet.\",\n", 45 | " name=\"content\",\n", 46 | " ),\n", 47 | " wvc.config.Property(\n", 48 | " data_type=wvc.config.DataType.TEXT,\n", 49 | " description=\"The author of the message.\",\n", 50 | " name=\"author\",\n", 51 | " ),\n", 52 | " ]\n", 53 | " )\n", 54 | "\n", 55 | "finally:\n", 56 | " client.close()" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": null, 62 | "id": "59205383", 63 | "metadata": {}, 64 | "outputs": [], 65 | "source": [] 66 | } 67 | ], 68 | "metadata": { 69 | "kernelspec": { 70 | "display_name": "Python 3 (ipykernel)", 71 | "language": "python", 72 | "name": "python3" 73 | }, 74 | "language_info": { 75 | "codemirror_mode": { 76 | "name": "ipython", 77 | "version": 3 78 | }, 79 | "file_extension": ".py", 80 | "mimetype": "text/x-python", 81 | "name": "python", 82 | "nbconvert_exporter": "python", 83 | "pygments_lexer": "ipython3", 84 | "version": "3.10.10" 85 | } 86 | }, 87 | "nbformat": 4, 88 | "nbformat_minor": 5 89 | } 90 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/Readme.md: -------------------------------------------------------------------------------- 1 | # RAGwithPersona Demo! 2 | 3 | - Install node_modules with `cd /rag-with-persona` `npm install` 4 | - Start the frontend with `npm start` 5 | - Start the backend with `cd ..` (if you changed into /rag-with-persona), Insert your API key `uvicorn backend:app --reload` 6 | - For Generative Feedback Loops, start Weaviate with `docker-compose up -d` (Insert your API key) 7 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/backend.py: -------------------------------------------------------------------------------- 1 | from fastapi import FastAPI, Query 2 | from fastapi.middleware.cors import CORSMiddleware 3 | from pydantic import BaseModel 4 | import dspy 5 | import cohere 6 | import weaviate 7 | from weaviate.util import get_valid_uuid 8 | from uuid import uuid4 9 | 10 | app = FastAPI() 11 | 12 | origins = ["http://localhost:3000"] 13 | 14 | app.add_middleware( 15 | CORSMiddleware, 16 | allow_origins=origins, 17 | allow_credentials=True, 18 | allow_methods=["*"], 19 | allow_headers=["*"], 20 | ) 21 | 22 | # Connect to Weaviate and configure LLM 23 | 24 | cohere_key = "" 25 | 26 | command_nightly = dspy.Cohere(model="command-nightly",max_tokens=1000, api_key=cohere_key) 27 | 28 | dspy.settings.configure(lm=command_nightly) 29 | 30 | weaviate_client = weaviate.connect_to_local() 31 | 32 | chat_snippets = weaviate_client.collections.get("ChatMessage") 33 | 34 | class AnswerWithPersona(dspy.Signature): 35 | """Respond to the most recent chat message with a response consistent with the given persona.""" 36 | 37 | persona = dspy.InputField() 38 | chat_history = dspy.InputField() 39 | additional_context = dspy.InputField(desc="Retrieval to help with the most recent question.") 40 | response = dspy.OutputField(prefix = "response:") 41 | 42 | class RAGwithPersona(dspy.Module): 43 | def __init__(self): 44 | super().__init__() 45 | self.rag_with_persona = dspy.Predict(AnswerWithPersona) 46 | 47 | def forward(self, persona, chat_history): 48 | response = self.rag_with_persona(persona=persona, chat_history=chat_history).response 49 | return dspy.Prediction(response=response) 50 | 51 | program = RAGwithPersona() 52 | 53 | class ChatbotData(BaseModel): 54 | messages: list 55 | topText: str 56 | 57 | @app.post("/RAGwithPersona") 58 | async def chatbot_endpoint(data: ChatbotData): 59 | # Access the chat history and top text from the request data 60 | chat_history = data.messages 61 | persona = data.topText 62 | 63 | # Parse the chat history into a string 64 | parsed_history = ", ".join([f"{chat['sender']}: {chat['text']}" for chat in chat_history]) 65 | program_output = program(persona=persona, chat_history=parsed_history) 66 | response = program_output.response 67 | user_chat_id = get_valid_uuid(uuid4()) 68 | chat_snippets.data.insert( 69 | properties={ 70 | "author": "user", 71 | "content": parsed_history[-1] 72 | }, 73 | uuid=user_chat_id 74 | ) 75 | program_chat_id = get_valid_uuid(uuid4()) 76 | chat_snippets.data.insert( 77 | properties={ 78 | "author": "RAGwithPersona", 79 | "content": response 80 | }, 81 | uuid=program_chat_id 82 | ) 83 | response_data = { 84 | "response": response 85 | } 86 | return response_data 87 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/docker-compose.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3.4' 3 | services: 4 | weaviate: 5 | command: 6 | - --host 7 | - 0.0.0.0 8 | - --port 9 | - '8080' 10 | - --scheme 11 | - http 12 | image: semitechnologies/weaviate:1.24.1 13 | ports: 14 | - 8080:8080 15 | - 50051:50051 16 | restart: on-failure:0 17 | environment: 18 | COHERE_APIKEY: 'sk-foobar' 19 | QUERY_DEFAULTS_LIMIT: 25 20 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 21 | PERSISTENCE_DATA_PATH: '/var/lib/weaviate' 22 | DEFAULT_VECTORIZER_MODULE: 'text2vec-cohere' 23 | ENABLE_MODULES: 'text2vec-cohere,generative-cohere' 24 | CLUSTER_HOSTNAME: 'node1' 25 | ... -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rag-with-persona", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.17.0", 7 | "@testing-library/react": "^13.4.0", 8 | "@testing-library/user-event": "^13.5.0", 9 | "react": "^18.2.0", 10 | "react-dom": "^18.2.0", 11 | "react-scripts": "5.0.1", 12 | "web-vitals": "^2.1.4" 13 | }, 14 | "scripts": { 15 | "start": "react-scripts start", 16 | "build": "react-scripts build", 17 | "test": "react-scripts test", 18 | "eject": "react-scripts eject" 19 | }, 20 | "eslintConfig": { 21 | "extends": [ 22 | "react-app", 23 | "react-app/jest" 24 | ] 25 | }, 26 | "browserslist": { 27 | "production": [ 28 | ">0.2%", 29 | "not dead", 30 | "not op_mini all" 31 | ], 32 | "development": [ 33 | "last 1 chrome version", 34 | "last 1 firefox version", 35 | "last 1 safari version" 36 | ] 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/public/favicon.ico -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 24 | 33 | React App 34 | 35 | 36 | 37 |
38 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/public/logo192.png -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/public/logo512.png -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/public/readme.md: -------------------------------------------------------------------------------- 1 | Public 2 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/readme.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ## `npm install` 10 | 11 | Downloads the node_modules 12 | 13 | ### `npm start` 14 | 15 | Runs the app in the development mode.\ 16 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 17 | 18 | The page will reload when you make changes.\ 19 | You may also see any lint errors in the console. 20 | 21 | ### `npm test` 22 | 23 | Launches the test runner in the interactive watch mode.\ 24 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 25 | 26 | ### `npm run build` 27 | 28 | Builds the app for production to the `build` folder.\ 29 | It correctly bundles React in production mode and optimizes the build for the best performance. 30 | 31 | The build is minified and the filenames include the hashes.\ 32 | Your app is ready to be deployed! 33 | 34 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 35 | 36 | ### `npm run eject` 37 | 38 | **Note: this is a one-way operation. Once you `eject`, you can't go back!** 39 | 40 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 41 | 42 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. 43 | 44 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. 45 | 46 | ## Learn More 47 | 48 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 49 | 50 | To learn React, check out the [React documentation](https://reactjs.org/). 51 | 52 | ### Code Splitting 53 | 54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) 55 | 56 | ### Analyzing the Bundle Size 57 | 58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) 59 | 60 | ### Making a Progressive Web App 61 | 62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) 63 | 64 | ### Advanced Configuration 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) 67 | 68 | ### Deployment 69 | 70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 71 | 72 | ### `npm run build` fails to minify 73 | 74 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) 75 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/src/App.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | box-sizing: border-box; 5 | } 6 | 7 | .chatbot { 8 | display: flex; 9 | flex-direction: column; 10 | height: 100vh; 11 | padding: 20px; 12 | } 13 | 14 | .chatbot h1 { 15 | text-align: center; 16 | margin-bottom: 1vh; 17 | font-size: 8vh; 18 | font-family: 'Montserrat'; 19 | font-weight: bold; 20 | color: #092844; 21 | } 22 | 23 | .top-text { 24 | margin-bottom: 20px; 25 | } 26 | 27 | .top-text input { 28 | width: 100%; 29 | padding: 20px; 30 | font-size: 3vh; 31 | font-family: "Plus Jakarta Sans"; 32 | } 33 | 34 | .chat-history { 35 | flex: 1; 36 | overflow-y: auto; 37 | margin-bottom: 20px; 38 | } 39 | 40 | .message { 41 | padding: 10px; 42 | margin-bottom: 10px; 43 | border-radius: 5px; 44 | font-family: "Plus Jakarta Sans"; 45 | font-size: 3vh; 46 | } 47 | 48 | .message.user { 49 | background-color: #e6e6e6; 50 | align-self: flex-end; 51 | font-family: "Plus Jakarta Sans"; 52 | font-size: 3vh; 53 | } 54 | 55 | .input-container { 56 | display: flex; 57 | } 58 | 59 | .input-container input { 60 | flex: 1; 61 | padding: 20px; 62 | font-family: "Plus Jakarta Sans"; 63 | font-size: 3vh; 64 | } 65 | 66 | .input-container button { 67 | padding: 10px 20px; 68 | font-family: "Montserrat"; 69 | font-weight: bold; 70 | font-size: 4vh; 71 | background-color: #092844; 72 | color: #fff; 73 | border: none; 74 | cursor: pointer; 75 | transition: 0.2s ease-in; 76 | } 77 | 78 | .input-container button:hover { 79 | color: #092844; 80 | background-color: white; 81 | } -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import backgroundImage from './assets/bg-light-3.png'; 3 | import './App.css'; 4 | 5 | const App = () => { 6 | const [messages, setMessages] = useState([]); 7 | const [inputText, setInputText] = useState(''); 8 | const [topText, setTopText] = useState(''); 9 | 10 | const handleInputChange = (event) => { 11 | setInputText(event.target.value); 12 | }; 13 | 14 | const handleTopTextChange = (event) => { 15 | setTopText(event.target.value); 16 | }; 17 | 18 | const handleSendMessage = () => { 19 | if (inputText.trim() !== '') { 20 | const newUserMessage = { 21 | text: inputText, 22 | sender: 'user', 23 | }; 24 | setMessages([...messages, newUserMessage]); 25 | setInputText(''); 26 | 27 | // Send the chat history and top text to the backend 28 | const data = { 29 | messages: [...messages, newUserMessage], 30 | topText: topText, 31 | }; 32 | fetch('http://localhost:8000/RAGwithPersona', { 33 | method: 'POST', 34 | headers: { 35 | 'Content-Type': 'application/json', 36 | }, 37 | body: JSON.stringify(data), 38 | }) 39 | .then((response) => response.json()) 40 | .then((data) => { 41 | // Add the response from the backend to the messages array 42 | const newBotMessage = { 43 | text: data.response, 44 | sender: 'bot', 45 | }; 46 | setMessages((prevMessages) => [...prevMessages, newBotMessage]); 47 | }) 48 | .catch((error) => { 49 | console.error('Error:', error); 50 | }); 51 | } 52 | }; 53 | 54 | return ( 55 |
56 |

RAGwithPersona

57 |
58 | 64 |
65 |
66 | {messages.map((message, index) => ( 67 |
68 | {message.text} 69 |
70 | ))} 71 |
72 |
73 | 79 | 80 |
81 |
82 | ); 83 | }; 84 | 85 | export default App; -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/src/assets/bg-light-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/src/assets/bg-light-3.png -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/src/assets/readme.md: -------------------------------------------------------------------------------- 1 | Images, etc. 2 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | const root = ReactDOM.createRoot(document.getElementById('root')); 8 | root.render( 9 | 10 | 11 | 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/src/readme.md: -------------------------------------------------------------------------------- 1 | React code! 2 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/RAGwithPersona/rag-with-persona/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/fullstack-recipes/readme.md: -------------------------------------------------------------------------------- 1 | # Fullstack DSPy demos! 2 | 3 | These demos connect a backend and frontend to run DSPy programs! 4 | 5 | ### RAGwithPersona 6 | Tell your chatbot the persona you would like it to have! 7 | This could be a celebrity like `LeBron James` or `Taylor Swift`. 8 | A persona can also be more abstract, such as `You are a detail-oriented engineer`. 9 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/llms/Readme.md: -------------------------------------------------------------------------------- 1 | # Quick Reference for connecting DSPy to different LLMs 2 | 3 | ```python 4 | gemini_1_5_pro = dspy.Google(model="gemini-1.5-pro-latest", api_key=google_api_key) 5 | gpt4 = dspy.OpenAI(model="gpt-4o", max_tokens=4_000, model_type="chat") 6 | claude_opus = dspy.Claude(model="claude-3-opus-20240229", api_key=CLAUDE_API_KEY) 7 | command_r_plus = dspy.Cohere(model="command-r-plus", max_input_tokens=32_000, max_tokens=4_000, api_key=cohere_api_key) 8 | ollama_llama3 = dspy.OllamaLocal(model="llama3.1") 9 | ``` 10 | 11 | Say hello test script: 12 | 13 | ```python 14 | lms = [ 15 | {"name": "Gemini-1.5-Pro", "lm": gemini_1_5_pro 16 | {"name": "GPT-4", "lm": gpt4}, 17 | {"name": "Claude Opus", "lm": claude_opus}, 18 | {"name": "Command R+", "lm": command_r_plus}, 19 | {"name": "Llama 3.1", "lm": ollama_llama3} 20 | ] 21 | 22 | connection_prompt = "Please say something interesting about Database Systems intended to impress me with your intelligence." 23 | 24 | print(f"\033[91mTesting the prompt:\n{connection_prompt}\n") 25 | 26 | for lm_dict in lms: 27 | lm, name = lm_dict["lm"], lm_dict["name"] 28 | with dspy.context(lm=lm): 29 | print(f"\033[92mResult for {name}\n") 30 | print(f"\033[0m{lm(connection_prompt)[0]}\n") 31 | ``` 32 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/llms/images/many-shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/llm-agent-frameworks/dspy/llms/images/many-shot.png -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/recipes/metrics/TypedEvaluator.py: -------------------------------------------------------------------------------- 1 | class Evaluator(dspy.Signature): 2 | """Evaluate the quality of a system's answer to a question according to a given criterion.""" 3 | 4 | criterion: str = dspy.InputField(desc="The evaluation criterion.") 5 | question: str = dspy.InputField(desc="The question asked to the system.") 6 | ground_truth_answer: str = dspy.InputField(desc="An expert written Ground Truth Answer to the question.") 7 | predicted_answer: str = dspy.InputField(desc="The system's answer to the question.") 8 | rating: float = dspy.OutputField(desc="A float rating between 1 and 5") 9 | 10 | 11 | def MetricWrapper(gold, pred, trace=None): 12 | alignment_criterion = "How aligned is the predicted_answer with the ground_truth?" 13 | return dspy.TypedPredictor(Evaluator)(criterion=alignment_criterion, 14 | question=gold.question, 15 | ground_truth_answer=gold.gold_answer, 16 | predicted_answer=pred.answer).rating 17 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/dspy/recipes/readme.md: -------------------------------------------------------------------------------- 1 | # DSPy Recipes 2 | 3 | - `RAGwithMultiAgentDebate`: Interesting RAG architecture where multiple candidate answers are geneated and aggregated with either the `Sample-and-Vote` method or another LLM call. 4 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/function-calling/composio/readme.md: -------------------------------------------------------------------------------- 1 | ## Weaviate and Composio 2 | 3 | This guide demonstrates how to use Weaviate and Composio together. Composio provides pre-defined actions for a large number of applications like Gmail, Slack, Trello etc. and allows us to create seamless integrations between these apps and LLMs/agents. Using these tools, we can control and manage a lot of the data that is generated and received by users. For example, the `gmail_new_gmail_message` trigger can be used to wait for a new email and when the mail arrives, the provided callback function gets executed with access to the new mail data. By connecting agents to a user's apps and leveraging a vector database like Weaviate to store, search, and manage data, we can create more personalized and contextually relevant agents. 4 | 5 | ### Connect with Composio and learn more 6 | 7 | If you encounter any problems, please let us know at our [Discord](https://discord.com/invite/cNruWaAhQk). 8 | 9 | Check out [Composio's documentation](https://docs.composio.dev/introduction/intro/overview) to learn more about how to use and integrate various tools for different usecases. -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/function-calling/google-vertex-ai/vertex-ai-query-agent.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## Weaviate Query Agent with Vertex AI\n", 8 | "\n", 9 | "This notebook will show you how to define the Weaviate Query Agent as a tool through Vertex AI.\n", 10 | "\n", 11 | "### Requirements\n", 12 | "1. Weaviate Cloud instance (WCD): The Weaviate Query Agent is only accessible through WCD at the moment. You can create a serverless cluster or a free 14-day sandbox [here](https://console.weaviate.cloud/).\n", 13 | "2. Enable the Vertex AI API: You must have an existing Google Cloud project and [enable the Vertex AI API](https://console.cloud.google.com/apis/).\n", 14 | " \n", 15 | " a. You'll need to install the Google Cloud CLI and initialize it with `gcloud init`\n", 16 | "3. Install the Google Gen AI SDK with `pip install --upgrade --quiet google-genai`\n", 17 | "4. Install the Weaviate Agents package with `pip install weaviate-agents`\n", 18 | "5. You'll need a Weaviate cluster with data. If you don't have one, check out [this notebook](integrations/Weaviate-Import-Example.ipynb) to import the Weaviate Blogs.\n" 19 | ] 20 | }, 21 | { 22 | "cell_type": "markdown", 23 | "metadata": {}, 24 | "source": [ 25 | "### Import libraries and keys" 26 | ] 27 | }, 28 | { 29 | "cell_type": "code", 30 | "execution_count": 8, 31 | "metadata": {}, 32 | "outputs": [], 33 | "source": [ 34 | "import weaviate\n", 35 | "from weaviate_agents.query import QueryAgent\n", 36 | "import os\n", 37 | "import json\n", 38 | "\n", 39 | "from google import genai\n", 40 | "from IPython.display import Markdown, display\n", 41 | "from google.genai.types import FunctionDeclaration, GenerateContentConfig, Part, Tool\n", 42 | "import requests" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": 24, 48 | "metadata": {}, 49 | "outputs": [], 50 | "source": [ 51 | "os.environ[\"WEAVIATE_URL\"] = \"\"\n", 52 | "os.environ[\"WEAVIATE_API_KEY\"] = \"\"\n", 53 | "os.environ[\"GCP_PROJECT_ID\"] = \"\"\n", 54 | "os.environ[\"GOOGLE_CLOUD_REGION\"] = \"\"" 55 | ] 56 | }, 57 | { 58 | "cell_type": "markdown", 59 | "metadata": {}, 60 | "source": [ 61 | "### Set Google Cloud project information" 62 | ] 63 | }, 64 | { 65 | "cell_type": "code", 66 | "execution_count": 6, 67 | "metadata": {}, 68 | "outputs": [], 69 | "source": [ 70 | "PROJECT_ID = os.getenv(\"GCP_PROJECT_ID\") \n", 71 | "\n", 72 | "LOCATION = os.getenv(\"GOOGLE_CLOUD_REGION\")\n", 73 | "\n", 74 | "client = genai.Client(vertexai=True, project=PROJECT_ID, location=LOCATION)" 75 | ] 76 | }, 77 | { 78 | "cell_type": "markdown", 79 | "metadata": {}, 80 | "source": [ 81 | "### Choose a model" 82 | ] 83 | }, 84 | { 85 | "cell_type": "code", 86 | "execution_count": 7, 87 | "metadata": {}, 88 | "outputs": [], 89 | "source": [ 90 | "MODEL_ID = \"gemini-2.0-flash-001\" # other model options are available on the Model Garden" 91 | ] 92 | }, 93 | { 94 | "cell_type": "markdown", 95 | "metadata": {}, 96 | "source": [ 97 | "### Define Query Agent function" 98 | ] 99 | }, 100 | { 101 | "cell_type": "code", 102 | "execution_count": 25, 103 | "metadata": {}, 104 | "outputs": [], 105 | "source": [ 106 | "def send_query_agent_request(query: str) -> str:\n", 107 | " \"\"\"\n", 108 | " Send a query to the database and get the response.\n", 109 | "\n", 110 | " Args:\n", 111 | " query (str): The question or query to search for in the database. This can be any natural language question related to the content stored in the database.\n", 112 | "\n", 113 | " Returns:\n", 114 | " str: The response from the database containing relevant information.\n", 115 | " \"\"\"\n", 116 | "\n", 117 | " weaviate_client = weaviate.connect_to_weaviate_cloud(\n", 118 | " cluster_url=os.getenv(\"WEAVIATE_URL\"),\n", 119 | " auth_credentials=weaviate.auth.AuthApiKey(os.getenv(\"WEAVIATE_API_KEY\")),\n", 120 | " )\n", 121 | " \n", 122 | " query_agent = QueryAgent(\n", 123 | " client=weaviate_client,\n", 124 | " collections=[\"Blogs\"] # we are using the Weaviate Embeddings for our Blogs collection\n", 125 | " )\n", 126 | " return query_agent.run(query).final_answer" 127 | ] 128 | }, 129 | { 130 | "cell_type": "code", 131 | "execution_count": null, 132 | "metadata": {}, 133 | "outputs": [ 134 | { 135 | "name": "stdout", 136 | "output_type": "stream", 137 | "text": [ 138 | "To deploy Weaviate on Docker, you need Docker and Docker Compose CLI. Download a 'docker-compose.yml' file using Weaviate's configuration tool to customize it. Then, navigate to the directory containing the file and run `docker compose up -d` in the terminal. This will start the setup in detached mode. Ensure the file is correctly named and located before starting. Refer to the Weaviate documentation for more configuration options.\n", 139 | "\n" 140 | ] 141 | } 142 | ], 143 | "source": [ 144 | "prompt = \"\"\"\n", 145 | "You are connected to a database that has a blog post on deploying Weaviate on Docker. \n", 146 | "Can you answer how I can Weaviate with Docker? \n", 147 | "\"\"\"\n", 148 | "\n", 149 | "response = client.models.generate_content(\n", 150 | " model=MODEL_ID,\n", 151 | " contents=prompt,\n", 152 | " config=GenerateContentConfig(tools=[send_query_agent_request], temperature=0),\n", 153 | ")\n", 154 | "print(response.text)" 155 | ] 156 | } 157 | ], 158 | "metadata": { 159 | "kernelspec": { 160 | "display_name": "Python 3", 161 | "language": "python", 162 | "name": "python3" 163 | }, 164 | "language_info": { 165 | "codemirror_mode": { 166 | "name": "ipython", 167 | "version": 3 168 | }, 169 | "file_extension": ".py", 170 | "mimetype": "text/x-python", 171 | "name": "python", 172 | "nbconvert_exporter": "python", 173 | "pygments_lexer": "ipython3", 174 | "version": "3.11.6" 175 | } 176 | }, 177 | "nbformat": 4, 178 | "nbformat_minor": 2 179 | } 180 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/function-calling/ollama/readme.md: -------------------------------------------------------------------------------- 1 | # Ollama and Weaviate 2 | 3 | Learn more about the Ollama Python and JavaScript libraries [here](https://ollama.com/blog/python-javascript-libraries)! 4 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/langchain/LCEL/readme.md: -------------------------------------------------------------------------------- 1 | # LangChain LCEL 2 | 3 | This repository currently contains a notebook showcasing how to define a language program with LangChain LCEL, compile it with DSPy, and convert it back to LangChain LCEL. 4 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/langchain/loading-data/brazil-wikipedia-article-text.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/llm-agent-frameworks/langchain/loading-data/brazil-wikipedia-article-text.pdf -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/langchain/loading-data/docker-compose.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3.4' 3 | services: 4 | weaviate: 5 | command: 6 | - --host 7 | - 0.0.0.0 8 | - --port 9 | - '8080' 10 | - --scheme 11 | - http 12 | image: semitechnologies/weaviate:1.22.3 13 | ports: 14 | - 8080:8080 15 | - 50051:50051 16 | volumes: 17 | - weaviate_data:/var/lib/weaviate 18 | restart: on-failure:0 19 | environment: 20 | COHERE_APIKEY: $COHERE_APIKEY 21 | QUERY_DEFAULTS_LIMIT: 25 22 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 23 | PERSISTENCE_DATA_PATH: '/var/lib/weaviate' 24 | DEFAULT_VECTORIZER_MODULE: 'text2vec-cohere' 25 | ENABLE_MODULES: 'text2vec-cohere,generative-cohere,reranker-cohere' 26 | CLUSTER_HOSTNAME: 'node1' 27 | volumes: 28 | weaviate_data: 29 | ... -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/langchain/loading-data/netherlands-wikipedia-article-text.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/llm-agent-frameworks/langchain/loading-data/netherlands-wikipedia-article-text.pdf -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/letta/architectural-visual.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/llm-agent-frameworks/letta/architectural-visual.png -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/letta/letta-create-agent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/llm-agent-frameworks/letta/letta-create-agent.png -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/letta/letta-tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/llm-agent-frameworks/letta/letta-tools.png -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/letta/letta-update-tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/llm-agent-frameworks/letta/letta-update-tools.png -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/letta/readme.md: -------------------------------------------------------------------------------- 1 | # Letta 2 | 3 | Check out the Letta documentation [here](https://docs.letta.com/agents/overview) and GitHub repo [here](https://github.com/cpacker/MemGPT)! 4 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/llamaindex/indexes-episode2/meeting-notes/meeting-notes.mdx: -------------------------------------------------------------------------------- 1 | Meeting Notes 2 | Date: July 13, 2023 3 | Attendees: Connor (C), Weaviate (W) 4 | 5 | Agenda: Exploring Multi-Tenancy with Weaviate's Vector Database 6 | 7 | Introduction and Goals of Meeting (B): 8 | 9 | Connor explained that the primary goal of the meeting was to discuss how Weaviate's vector database could be integrated into Connor's platform, a photo sharing platform, with a specific focus on multi-tenancy. 10 | Explanation of Vector Databases (W): 11 | 12 | Weaviate provided an overview of vector databases, focusing on how they handle high-dimensional data points and efficiently perform similarity searches. 13 | Benefits of Multi-Tenancy (W): 14 | 15 | Weaviate explained the concept of multi-tenancy, highlighting its potential for resource sharing, cost reduction, and ease of maintenance. They mentioned that their vector database is capable of supporting multi-tenant architecture. 16 | Connors's Interest in Multi-Tenancy (B): 17 | 18 | Connor confirmed the importance of multi-tenancy for their platform. Given that they serve many different users and organizations, it's crucial for them to isolate each tenant's data while still using the same physical infrastructure. 19 | Implementing Multi-Tenancy with Weaviate (W): 20 | 21 | Weaviate laid out a preliminary plan for implementing multi-tenancy. This included isolating data on a per-tenant basis, setting up resource quotas and access controls, and providing tools for monitoring and management. They also discussed how the vector search capabilities could be applied on a per-tenant basis. 22 | Concerns and Questions (B): 23 | 24 | Connor raised questions about how to handle data migration, backup, and recovery in a multi-tenant setup. They also asked about scalability and performance considerations, including how to ensure one tenant's activities don't impact others'. 25 | Addressing Concerns and Next Steps (B): 26 | 27 | Weaviate addressed Connor's concerns, explaining how they handle data management and backups, and assuring them that their system is designed to prevent cross-tenant performance impacts. They proposed a follow-up meeting to delve into technical details and to start planning a potential proof-of-concept integration. 28 | Next Steps: A follow-up meeting will be arranged to discuss technical details, potential challenges, and the planning of a proof-of-concept for the multi-tenant vector database integration. -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/llamaindex/simple-query-engine/simple-query-engine.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "%pip install -U weaviate-client llama-index llama-index-vector-stores-weaviate llama-index-embeddings-openai" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 3, 15 | "metadata": {}, 16 | "outputs": [], 17 | "source": [ 18 | "import os\n", 19 | "import openai\n", 20 | "import weaviate\n", 21 | "from weaviate import classes as wvc\n", 22 | "\n", 23 | "from llama_index.core import SimpleDirectoryReader\n", 24 | "from llama_index.core.node_parser import SimpleNodeParser\n", 25 | "from llama_index.vector_stores.weaviate import WeaviateVectorStore\n", 26 | "from llama_index.core import VectorStoreIndex, StorageContext, Settings\n", 27 | "\n", 28 | "from llama_index.embeddings.openai import OpenAIEmbedding\n", 29 | "\n", 30 | "\n", 31 | "# global\n", 32 | "Settings.embed_model = OpenAIEmbedding(model=\"text-embedding-3-small\")\n", 33 | "\n", 34 | "# Lets set the OPENAI key\n", 35 | "# os.environ[\"OPENAI_API_KEY\"] = \"sk-key\"\n", 36 | "openai.api_key = os.environ[\"OPENAI_API_KEY\"]" 37 | ] 38 | }, 39 | { 40 | "cell_type": "code", 41 | "execution_count": null, 42 | "metadata": {}, 43 | "outputs": [], 44 | "source": [ 45 | "client = weaviate.connect_to_embedded(\n", 46 | " headers={\n", 47 | " \"X-OpenAI-Api-Key\": os.environ[\"OPENAI_API_KEY\"]\n", 48 | " }\n", 49 | ")\n", 50 | "\n", 51 | "# client = weaviate.connect_to_local(\n", 52 | "# headers={\n", 53 | "# \"X-OpenAI-Api-Key\": os.environ[\"OPENAI_API_KEY\"]\n", 54 | "# }\n", 55 | "# )" 56 | ] 57 | }, 58 | { 59 | "cell_type": "code", 60 | "execution_count": 5, 61 | "metadata": {}, 62 | "outputs": [], 63 | "source": [ 64 | "client.collections.delete(\"BlogPost\")\n", 65 | "\n", 66 | "collection = client.collections.create(\n", 67 | " name=\"BlogPost\",\n", 68 | " description=\"Blog post from the Weaviate website\",\n", 69 | " vectorizer_config=wvc.config.Configure.Vectorizer.text2vec_openai(),\n", 70 | " generative_config=wvc.config.Configure.Generative.openai(model=\"gpt-3.5-turbo\"),\n", 71 | " properties=[\n", 72 | " wvc.config.Property(name=\"content\", data_type=wvc.config.DataType.TEXT)\n", 73 | " ]\n", 74 | ")" 75 | ] 76 | }, 77 | { 78 | "cell_type": "code", 79 | "execution_count": 6, 80 | "metadata": {}, 81 | "outputs": [], 82 | "source": [ 83 | "documents = SimpleDirectoryReader('../data-loaders-episode1/data').load_data()\n", 84 | "\n", 85 | "# chunk up the blog posts into nodes \n", 86 | "parser = SimpleNodeParser()\n", 87 | "nodes = parser.get_nodes_from_documents(documents)" 88 | ] 89 | }, 90 | { 91 | "cell_type": "code", 92 | "execution_count": 7, 93 | "metadata": {}, 94 | "outputs": [ 95 | { 96 | "name": "stdout", 97 | "output_type": "stream", 98 | "text": [ 99 | "Number of nodes: 9\n", 100 | "Node ID: 99fbe400-8ca8-4ed3-8ada-13bb9c428967\n", 101 | "Text: title: What is Ref2Vec and why you need it for your\n", 102 | "recommendation system Weaviate 1.16 introduced the\n", 103 | "[Ref2Vec](/developers/weaviate/modules/retriever-vectorizer-\n", 104 | "modules/ref2vec-centroid) module. In this article, we give you an\n", 105 | "overview of what Ref2Vec is and some examples in which it can add\n", 106 | "value such as recommendations or representing long ...\n" 107 | ] 108 | } 109 | ], 110 | "source": [ 111 | "parser = SimpleNodeParser()\n", 112 | "nodes = parser.get_nodes_from_documents(documents)\n", 113 | "print(\"Number of nodes:\", len(nodes))\n", 114 | "print(nodes[0])" 115 | ] 116 | }, 117 | { 118 | "cell_type": "code", 119 | "execution_count": 8, 120 | "metadata": {}, 121 | "outputs": [], 122 | "source": [ 123 | "# Let's name our index properly as BlogPost, as we will need it later.\n", 124 | "vector_store = WeaviateVectorStore(\n", 125 | " weaviate_client=client, index_name=\"BlogPost\"\n", 126 | ")\n", 127 | "storage_context = StorageContext.from_defaults(vector_store=vector_store)\n", 128 | "index = VectorStoreIndex.from_documents(\n", 129 | " documents, storage_context=storage_context\n", 130 | ")" 131 | ] 132 | }, 133 | { 134 | "cell_type": "code", 135 | "execution_count": 9, 136 | "metadata": {}, 137 | "outputs": [ 138 | { 139 | "name": "stdout", 140 | "output_type": "stream", 141 | "text": [ 142 | "The intersection between LLMs and search lies in the challenge of finding suitable representations for long objects, particularly text documents that exceed the input limit of Deep Transformer Neural Networks. This motivates the interest in Hybrid Search techniques that combine Vector Search with algorithms like BM25, which is well-suited for handling text sequences longer than 512 tokens. Ref2Vec can play a role in addressing this challenge by helping to represent long documents effectively in search applications.\n" 143 | ] 144 | } 145 | ], 146 | "source": [ 147 | "# now, at any time, we can get our vector store and query it.\n", 148 | "\n", 149 | "vector_store = WeaviateVectorStore(\n", 150 | " weaviate_client=client, index_name=\"BlogPost\"\n", 151 | ")\n", 152 | "\n", 153 | "loaded_index = VectorStoreIndex.from_vector_store(vector_store)\n", 154 | "\n", 155 | "query_engine = loaded_index.as_query_engine()\n", 156 | "response = query_engine.query(\"What is the intersection between LLMs and search?\")\n", 157 | "print(response)" 158 | ] 159 | } 160 | ], 161 | "metadata": { 162 | "kernelspec": { 163 | "display_name": ".venv", 164 | "language": "python", 165 | "name": "python3" 166 | }, 167 | "language_info": { 168 | "codemirror_mode": { 169 | "name": "ipython", 170 | "version": 3 171 | }, 172 | "file_extension": ".py", 173 | "mimetype": "text/x-python", 174 | "name": "python", 175 | "nbconvert_exporter": "python", 176 | "pygments_lexer": "ipython3", 177 | "version": "3.12.5" 178 | } 179 | }, 180 | "nbformat": 4, 181 | "nbformat_minor": 2 182 | } 183 | -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/pydantic/pydantic-logfire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/llm-agent-frameworks/pydantic/pydantic-logfire.png -------------------------------------------------------------------------------- /integrations/llm-agent-frameworks/readme.md: -------------------------------------------------------------------------------- 1 | # LLM and Agent Frameworks 2 | These frameworks facilitate building applications around Large Language Models! Please see the following list for more information about each of the partners featured in this repository: 3 | 4 | - [Agno](https://docs.agno.com/introduction) 5 | - [Composio](https://docs.composio.dev/introduction/intro/overview) 6 | - [CrewAI](https://docs.crewai.com/introduction) 7 | - [DSPy](https://dspy.ai/deep-dive/retrieval_models_clients/WeaviateRM) 8 | - [Haystack](https://haystack.deepset.ai/integrations/weaviate-document-store) 9 | - [LangChain](https://python.langchain.com/v0.2/docs/integrations/vectorstores/weaviate/) 10 | - [Letta](https://docs.letta.com/introduction) 11 | - [LlamaIndex](https://docs.llamaindex.ai/en/stable/api_reference/storage/vector_store/weaviate/) 12 | - [Ollama](https://ollama.com/blog/tool-support) 13 | - [OpenAI Swarm](https://github.com/openai/swarm) 14 | - [Pydantic](https://docs.pydantic.dev/latest/) 15 | - [Semantic Kernel](https://github.com/microsoft/semantic-kernel/tree/main/python/semantic_kernel/connectors/memory/weaviate) 16 | -------------------------------------------------------------------------------- /integrations/operations/arize/DSPy-Instrumentor.py: -------------------------------------------------------------------------------- 1 | # Phoenix Setup 2 | import phoenix as px 3 | phoenix_session = px.launch_app() 4 | 5 | # Note this will also catch calls to Weaviate when connected to the DSPy WeaviateRM 6 | from openinference.instrumentation.dspy import DSPyInstrumentor 7 | from opentelemetry import trace as trace_api 8 | from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter 9 | from opentelemetry.sdk import trace as trace_sdk 10 | from opentelemetry.sdk.trace.export import SimpleSpanProcessor 11 | 12 | endpoint = "http://127.0.0.1:6006/v1/traces" 13 | tracer_provider = trace_sdk.TracerProvider() 14 | span_otlp_exporter = OTLPSpanExporter(endpoint=endpoint) 15 | tracer_provider.add_span_processor(SimpleSpanProcessor(span_exporter=span_otlp_exporter)) 16 | 17 | trace_api.set_tracer_provider(tracer_provider=tracer_provider) 18 | DSPyInstrumentor().instrument() 19 | -------------------------------------------------------------------------------- /integrations/operations/langwatch/docker-compose.yml: -------------------------------------------------------------------------------- 1 | # Run it with: 2 | # 3 | # COHERE_API_KEY=your_api_key docker compose up 4 | # 5 | 6 | --- 7 | version: "3.4" 8 | services: 9 | weaviate: 10 | command: 11 | - --host 12 | - 0.0.0.0 13 | - --port 14 | - "8080" 15 | - --scheme 16 | - http 17 | image: cr.weaviate.io/semitechnologies/weaviate:1.26.1 18 | ports: 19 | - 8080:8080 20 | - 50051:50051 21 | volumes: 22 | - weaviate_data:/var/lib/weaviate 23 | restart: on-failure:0 24 | environment: 25 | QUERY_DEFAULTS_LIMIT: 25 26 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: "true" 27 | PERSISTENCE_DATA_PATH: "/var/lib/weaviate" 28 | ENABLE_MODULES: "text2vec-cohere,text2vec-huggingface,text2vec-palm,text2vec-openai,generative-openai,generative-cohere,generative-palm,ref2vec-centroid,reranker-cohere,qna-openai" 29 | DEFAULT_VECTORIZER_MODULE: text2vec-cohere 30 | COHERE_APIKEY: ${COHERE_API_KEY} 31 | CLUSTER_HOSTNAME: "node1" 32 | volumes: 33 | weaviate_data: 34 | -------------------------------------------------------------------------------- /integrations/operations/langwatch/optimization_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/operations/langwatch/optimization_screenshot.png -------------------------------------------------------------------------------- /integrations/operations/langwatch/tracing_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/operations/langwatch/tracing_screenshot.png -------------------------------------------------------------------------------- /integrations/operations/patronus/images/patronus-gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/operations/patronus/images/patronus-gui.png -------------------------------------------------------------------------------- /integrations/operations/patronus/images/patronus-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/operations/patronus/images/patronus-logo.png -------------------------------------------------------------------------------- /integrations/operations/patronus/images/percival-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/operations/patronus/images/percival-1.png -------------------------------------------------------------------------------- /integrations/operations/patronus/images/percival-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/operations/patronus/images/percival-2.png -------------------------------------------------------------------------------- /integrations/operations/trulens/images/trulens_weaviate_identify_issues.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/operations/trulens/images/trulens_weaviate_identify_issues.gif -------------------------------------------------------------------------------- /integrations/operations/trulens/images/trulens_weaviate_validate.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/operations/trulens/images/trulens_weaviate_validate.gif -------------------------------------------------------------------------------- /integrations/operations/weights_and_biases/RAG-optimization-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/integrations/operations/weights_and_biases/RAG-optimization-dashboard.png -------------------------------------------------------------------------------- /integrations/operations/weights_and_biases/readme.md: -------------------------------------------------------------------------------- 1 | # Weights & Biases 2 | 3 | Weights & Biases is "The AI developer platform" helping AI developers to "build models faster, fine-tune LLMs, develop GenAI applications with confidence, all in one system of record developers are excited to use". 4 | 5 | We currently have an example of using wandb logging to monitor optimizing a RAG system with DSPy, Weaviate, and Cohere! 6 | -------------------------------------------------------------------------------- /weaviate-features/_docker/docker-compose-apis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3.4' 3 | services: 4 | weaviate: 5 | command: 6 | - --host 7 | - 0.0.0.0 8 | - --port 9 | - '8080' 10 | - --scheme 11 | - http 12 | image: semitechnologies/weaviate:1.23.9 13 | ports: 14 | - 8080:8080 15 | - 50051:50051 16 | volumes: 17 | - weaviate_data:/var/lib/weaviate 18 | restart: on-failure:0 19 | environment: 20 | QUERY_DEFAULTS_LIMIT: 25 21 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 22 | PERSISTENCE_DATA_PATH: '/var/lib/weaviate' 23 | DEFAULT_VECTORIZER_MODULE: 'none' 24 | ENABLE_MODULES: 'text2vec-aws,text2vec-cohere,text2vec-palm,text2vec-huggingface,text2vec-jinaai,text2vec-openai,generative-anyscale,generative-cohere,generative-palm,generative-openai,ref2vec-centroid,reranker-cohere,qna-openai' 25 | CLUSTER_HOSTNAME: 'node1' 26 | volumes: 27 | weaviate_data: 28 | ... -------------------------------------------------------------------------------- /weaviate-features/_docker/docker-compose-contextionary.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3.4' 3 | services: 4 | weaviate: 5 | command: 6 | - --host 7 | - 0.0.0.0 8 | - --port 9 | - '8080' 10 | - --scheme 11 | - http 12 | image: semitechnologies/weaviate:1.23.9 13 | ports: 14 | - 8080:8080 15 | - 50051:50051 16 | volumes: 17 | - weaviate_data:/var/lib/weaviate 18 | restart: on-failure:0 19 | environment: 20 | CONTEXTIONARY_URL: contextionary:9999 21 | QUERY_DEFAULTS_LIMIT: 25 22 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 23 | PERSISTENCE_DATA_PATH: '/var/lib/weaviate' 24 | DEFAULT_VECTORIZER_MODULE: 'text2vec-contextionary' 25 | ENABLE_MODULES: 'text2vec-contextionary' 26 | CLUSTER_HOSTNAME: 'node1' 27 | contextionary: 28 | environment: 29 | OCCURRENCE_WEIGHT_LINEAR_FACTOR: 0.75 30 | EXTENSIONS_STORAGE_MODE: weaviate 31 | EXTENSIONS_STORAGE_ORIGIN: http://weaviate:8080 32 | NEIGHBOR_OCCURRENCE_IGNORE_PERCENTILE: 5 33 | ENABLE_COMPOUND_SPLITTING: 'false' 34 | image: semitechnologies/contextionary:en0.16.0-v1.2.1 35 | ports: 36 | - 9999:9999 37 | volumes: 38 | weaviate_data: 39 | ... -------------------------------------------------------------------------------- /weaviate-features/_docker/docker-compose-transformers.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3.4' 3 | services: 4 | weaviate: 5 | command: 6 | - --host 7 | - 0.0.0.0 8 | - --port 9 | - '8080' 10 | - --scheme 11 | - http 12 | image: semitechnologies/weaviate:1.23.9 13 | ports: 14 | - 8080:8080 15 | - 50051:50051 16 | volumes: 17 | - weaviate_data:/var/lib/weaviate 18 | restart: on-failure:0 19 | environment: 20 | TRANSFORMERS_INFERENCE_API: 'http://t2v-transformers:8080' 21 | QUERY_DEFAULTS_LIMIT: 25 22 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 23 | PERSISTENCE_DATA_PATH: '/var/lib/weaviate' 24 | DEFAULT_VECTORIZER_MODULE: 'text2vec-transformers' 25 | ENABLE_MODULES: 'text2vec-transformers' 26 | CLUSTER_HOSTNAME: 'node1' 27 | t2v-transformers: 28 | image: semitechnologies/transformers-inference:google-flan-t5-large 29 | environment: 30 | ENABLE_CUDA: '0' 31 | volumes: 32 | weaviate_data: 33 | ... -------------------------------------------------------------------------------- /weaviate-features/batch/ingest-retry/README.md: -------------------------------------------------------------------------------- 1 | # Ingesting Data into Weaviate 2 | 3 | This directory contains the code used to ingest the data into Weaviate. 4 | 5 | ## Amazon Product Dataset 6 | 7 | You can download the Amazon product dataset from [here]([https://nijianmo.github.io/amazon/index.html](https://nijianmo.github.io/amazon/index.html#complete-data)). 8 | 9 | Download the "CDs and Vinyl" dataset called "metadata" (not "reviews") and unzip it, then run code similar the following to split the data into multiple files: 10 | 11 | ```bash 12 | split -l 10000 -d --additional-suffix=.json Amazon_Meta_CDs_Vinyl.json Amazon_Meta_CDs_Vinyl_ 13 | ``` 14 | 15 | We have included a snippet of that with the first 10,000 lines of the CDs and Vinyl dataset in the Amazon_Meta_CDs_Vinyl_00.json 16 | 17 | ## Setting up to run the sample 18 | 19 | ```bash 20 | python -m venv .venv 21 | . .venv/bin/activate 22 | pip install -r requirements.txt 23 | ``` 24 | 25 | Also make sure that you start the weaviate docker images and ollama like below: 26 | 27 | ```bash 28 | docker compose -f docker-compose.yaml up -d 29 | ollama serve 30 | ollama pull mxbai-embed-large:latest 31 | ollama pull llama3.2:latest 32 | ``` -------------------------------------------------------------------------------- /weaviate-features/batch/ingest-retry/docker-compose.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | weaviate: 4 | command: 5 | - --host 6 | - 0.0.0.0 7 | - --port 8 | - '8080' 9 | - --scheme 10 | - http 11 | image: cr.weaviate.io/semitechnologies/weaviate:latest 12 | ports: 13 | - 8080:8080 14 | - 50051:50051 15 | volumes: 16 | - ./weaviate_data:/var/lib/weaviate 17 | restart: on-failure:0 18 | environment: 19 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 20 | PERSISTENCE_DATA_PATH: '/var/lib/weaviate' 21 | DEFAULT_VECTORIZER_MODULE: 'text2vec-ollama' 22 | ENABLE_MODULES: 'text2vec-ollama,generative-ollama' 23 | CLUSTER_HOSTNAME: 'node1' 24 | ASYNC_INDEXING: 'true' 25 | #LOG_LEVEL: 'trace' 26 | ... 27 | -------------------------------------------------------------------------------- /weaviate-features/batch/ingest-retry/requirements.txt: -------------------------------------------------------------------------------- 1 | weaviate-client 2 | ijson 3 | -------------------------------------------------------------------------------- /weaviate-features/bring-your-own-vectors-and-multi-lingual/modernBERT_embeddings/vector_search_modernbert_cover_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/bring-your-own-vectors-and-multi-lingual/modernBERT_embeddings/vector_search_modernbert_cover_image.png -------------------------------------------------------------------------------- /weaviate-features/classification/knn/compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | 3 | volumes: 4 | weaviate_data: 5 | 6 | services: 7 | weaviate: 8 | command: 9 | - --host 10 | - 0.0.0.0 11 | - --port 12 | - '8080' 13 | - --scheme 14 | - http 15 | image: semitechnologies/weaviate:latest 16 | restart: on-failure:0 17 | ports: 18 | - "8080:8080" 19 | - "50051:50051" 20 | environment: 21 | QUERY_DEFAULTS_LIMIT: 25 22 | QUERY_MAXIMUM_RESULTS: 10000 23 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 24 | PERSISTENCE_DATA_PATH: './data' 25 | DEFAULT_VECTORIZER_MODULE: text2vec-transformers 26 | ENABLE_MODULES: text2vec-transformers 27 | CLUSTER_HOSTNAME: 'node1' 28 | AUTOSCHEMA_ENABLED: 'true' 29 | TRANSFORMERS_INFERENCE_API: http://t2v-transformers:8080 30 | volumes: 31 | - weaviate_data:/var/lib/weaviate 32 | t2v-transformers: 33 | image: semitechnologies/transformers-inference:sentence-transformers-paraphrase-multilingual-MiniLM-L12-v2 34 | environment: 35 | ENABLE_CUDA: '0' -------------------------------------------------------------------------------- /weaviate-features/classification/zeroshot/add_data.py: -------------------------------------------------------------------------------- 1 | import weaviate 2 | 3 | tickets = [ 4 | {"body": "I cannot connect to the internet", "id":1}, 5 | {"body": "I wat to put some text in a paper", "id":2}, 6 | {"body": "My computer is slow, I cannot turn it on", "id":3}, 7 | {"body": "I want to create some spreadsheets, but I cannot open the program", "id":4}, 8 | ] 9 | 10 | categories = [ 11 | "Network", 12 | "Printing", 13 | "Hardware", 14 | "Software", 15 | ] 16 | 17 | client = weaviate.Client("http://localhost:8080") 18 | 19 | # clear 20 | #client.schema.delete_all() 21 | 22 | category_class = { 23 | "class": 'Category', 24 | "description": 'support ticket', 25 | "properties": [ 26 | { 27 | "dataType": [ 'text'], 28 | "description": 'name of category', 29 | "name": 'name', 30 | } 31 | ] 32 | } 33 | if not client.schema.exists("Category"): 34 | client.schema.create_class(category_class) 35 | # add the categories as data objects 36 | print("#### ADDING CATEGORIES") 37 | client.batch.configure(batch_size=100) # Configure batch 38 | with client.batch as batch: 39 | for category in categories: 40 | cat_id = batch.add_data_object({"name": category}, "Category", weaviate.util.generate_uuid5(category)) 41 | print(category, cat_id) 42 | 43 | ticket_class = { 44 | "class": 'Ticket', 45 | "description": 'support ticket', 46 | "properties": [ 47 | { 48 | "name": 'body', 49 | "description": 'ticket text', 50 | "dataType": [ 'text'], 51 | }, 52 | { 53 | "name": 'ticket_id', 54 | "description": 'ticket id', 55 | "dataType": [ 'number'], 56 | }, 57 | { 58 | "name": 'category', 59 | "description": 'ticket topic', 60 | "dataType": ["Category"], 61 | } 62 | ] 63 | } 64 | if not client.schema.exists("Ticket"): 65 | client.schema.create_class(ticket_class) 66 | print("#### ADDING TICKETS") 67 | client.batch.configure(batch_size=100) # Configure batch 68 | with client.batch as batch: 69 | for ticket in tickets: 70 | ticket_id = batch.add_data_object( 71 | {"body": ticket["body"], "ticket_id": ticket["id"]}, "Ticket", 72 | weaviate.util.generate_uuid5(ticket["id"]) 73 | ) 74 | print(ticket, ticket_id) 75 | 76 | 77 | # now the fun part 78 | client.classification.schedule()\ 79 | .with_type("zeroshot")\ 80 | .with_class_name("Ticket")\ 81 | .with_classify_properties(["category"])\ 82 | .with_based_on_properties(["body"])\ 83 | .do() 84 | 85 | # just like that, you have your items categorized 86 | results = client.query.get("Ticket", "body category{ ... on Category{name}}").do() 87 | for ticket in results["data"]["Get"]["Ticket"]: 88 | print("#" * 10) 89 | print("Ticket:", ticket["body"]) 90 | print("Category: ", ticket["category"][0]["name"]) -------------------------------------------------------------------------------- /weaviate-features/classification/zeroshot/compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | 3 | volumes: 4 | weaviate_data: 5 | 6 | services: 7 | weaviate: 8 | command: 9 | - --host 10 | - 0.0.0.0 11 | - --port 12 | - '8080' 13 | - --scheme 14 | - http 15 | image: semitechnologies/weaviate:latest 16 | restart: on-failure:0 17 | ports: 18 | - "8080:8080" 19 | - "50051:50051" 20 | environment: 21 | QUERY_DEFAULTS_LIMIT: 25 22 | QUERY_MAXIMUM_RESULTS: 10000 23 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 24 | PERSISTENCE_DATA_PATH: './data' 25 | DEFAULT_VECTORIZER_MODULE: text2vec-transformers 26 | ENABLE_MODULES: text2vec-transformers 27 | CLUSTER_HOSTNAME: 'node1' 28 | AUTOSCHEMA_ENABLED: 'true' 29 | TRANSFORMERS_INFERENCE_API: http://t2v-transformers:8080 30 | volumes: 31 | - weaviate_data:/var/lib/weaviate 32 | t2v-transformers: 33 | image: semitechnologies/transformers-inference:sentence-transformers-paraphrase-multilingual-MiniLM-L12-v2 34 | environment: 35 | ENABLE_CUDA: '0' -------------------------------------------------------------------------------- /weaviate-features/evaluation/pastry_data.csv: -------------------------------------------------------------------------------- 1 | pastry_id;pastry_name;pastry_description 2 | 1;Bagel;A classic round bread with a chewy interior and a golden crust, perfect for toasting or topping with cream cheese, smoked salmon, or your favorite spreads. 3 | 2;Roll;Soft and pillowy, these rolls are versatile companions to any meal. Enjoy them fresh out of the oven or sliced for sandwiches, filled with your choice of meats, cheeses, and veggies. 4 | 3;Donut;Indulge in these sweet, fried delights. Glazed, powdered, or filled with decadent creams and fruit jams, each bite is a delightful burst of flavor and nostalgia. 5 | 4;Muffin;Moist and tender, these muffins are bursting with flavor. Whether you prefer classic blueberry, indulgent chocolate chip, or hearty bran, there's a muffin for every craving. 6 | 5;Croissant;Buttery layers of flaky pastry are folded to perfection, creating a delicate and irresistible treat. Enjoy them plain, stuffed with savory fillings, or paired with your favorite coffee. 7 | 6;Scone;Crumbly yet tender, these scones are the epitome of comfort. Enjoy them plain or studded with fruits, nuts, or chocolate chips, accompanied by a dollop of clotted cream and jam. 8 | 7;Pretzel;Crunchy on the outside, soft on the inside, these pretzels are a salty snack lover's dream. Enjoy them twisted into traditional shapes or dipped in sweet or savory toppings for a delightful twist. 9 | 8;Sandwich;Freshly baked bread is the foundation for these hearty sandwiches. Pile on layers of meats, cheeses, crisp vegetables, and flavorful spreads for a satisfying meal on the go. -------------------------------------------------------------------------------- /weaviate-features/filters/filter_none.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Filtering by null values" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 2, 13 | "metadata": {}, 14 | "outputs": [], 15 | "source": [ 16 | "import weaviate\n", 17 | "from weaviate import classes as wvc\n", 18 | "client = weaviate.connect_to_local()\n", 19 | "client.collections.delete(\"Test\")" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "metadata": {}, 25 | "source": [ 26 | "First, we need to create a class and make sure that the class [has index_null_state as True](https://weaviate.io/developers/weaviate/config-refs/schema#invertedindexconfig--indexnullstate)\n", 27 | "by default it comes turned off, as indexing the null state of a property will require Weaviate to create an index also for that state." 28 | ] 29 | }, 30 | { 31 | "cell_type": "code", 32 | "execution_count": 3, 33 | "metadata": {}, 34 | "outputs": [], 35 | "source": [ 36 | "from weaviate import classes as wvc\n", 37 | "col = client.collections.create(\n", 38 | " \"Test\",\n", 39 | " inverted_index_config=wvc.config.Configure.inverted_index(\n", 40 | " index_null_state=True\n", 41 | " )\n", 42 | ")" 43 | ] 44 | }, 45 | { 46 | "cell_type": "markdown", 47 | "metadata": {}, 48 | "source": [ 49 | "Now, let's insert two data objects, one with `data` and the other one without" 50 | ] 51 | }, 52 | { 53 | "cell_type": "code", 54 | "execution_count": 4, 55 | "metadata": {}, 56 | "outputs": [ 57 | { 58 | "data": { 59 | "text/plain": [ 60 | "UUID('6d2bf318-ac10-4335-b4b6-c61380cf0a2a')" 61 | ] 62 | }, 63 | "execution_count": 4, 64 | "metadata": {}, 65 | "output_type": "execute_result" 66 | } 67 | ], 68 | "source": [ 69 | "col.data.insert({\"text\": \"this have\", \"data\": \"have\" })\n", 70 | "col.data.insert({\"text\": \"this doesn't\"})" 71 | ] 72 | }, 73 | { 74 | "cell_type": "markdown", 75 | "metadata": {}, 76 | "source": [ 77 | "Let's filter for objects that **does have data**" 78 | ] 79 | }, 80 | { 81 | "cell_type": "code", 82 | "execution_count": 6, 83 | "metadata": {}, 84 | "outputs": [ 85 | { 86 | "name": "stdout", 87 | "output_type": "stream", 88 | "text": [ 89 | "{'text': 'this have', 'data': 'have'}\n" 90 | ] 91 | } 92 | ], 93 | "source": [ 94 | "results = col.query.fetch_objects(\n", 95 | " filters=wvc.query.Filter.by_property(\"data\").is_none(False)\n", 96 | ")\n", 97 | "print(results.objects[0].properties)" 98 | ] 99 | }, 100 | { 101 | "cell_type": "markdown", 102 | "metadata": {}, 103 | "source": [ 104 | "Now objects that **doesnt have data**" 105 | ] 106 | }, 107 | { 108 | "cell_type": "code", 109 | "execution_count": 8, 110 | "metadata": {}, 111 | "outputs": [ 112 | { 113 | "name": "stdout", 114 | "output_type": "stream", 115 | "text": [ 116 | "{'text': \"this doesn't\", 'data': None}\n" 117 | ] 118 | } 119 | ], 120 | "source": [ 121 | "results = col.query.fetch_objects(\n", 122 | " filters=wvc.query.Filter.by_property(\"data\").is_none(True)\n", 123 | ")\n", 124 | "print(results.objects[0].properties)" 125 | ] 126 | } 127 | ], 128 | "metadata": { 129 | "kernelspec": { 130 | "display_name": "venv", 131 | "language": "python", 132 | "name": "python3" 133 | }, 134 | "language_info": { 135 | "codemirror_mode": { 136 | "name": "ipython", 137 | "version": 3 138 | }, 139 | "file_extension": ".py", 140 | "mimetype": "text/x-python", 141 | "name": "python", 142 | "nbconvert_exporter": "python", 143 | "pygments_lexer": "ipython3", 144 | "version": "3.11.8" 145 | } 146 | }, 147 | "nbformat": 4, 148 | "nbformat_minor": 2 149 | } 150 | -------------------------------------------------------------------------------- /weaviate-features/generative-search/from_dspy/readme.md: -------------------------------------------------------------------------------- 1 | # From DSPy 2 | These notebooks will show you how to optimize a RAG program with DSPy to serve in Weaviate's `generative-search` modules! 3 | -------------------------------------------------------------------------------- /weaviate-features/hybrid-search/snowflake-embed/docker-compose-t2v-snowflake.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3.4' 3 | services: 4 | weaviate: 5 | command: 6 | - --host 7 | - 0.0.0.0 8 | - --port 9 | - '8080' 10 | - --scheme 11 | - http 12 | image: semitechnologies/weaviate:1.24.10 13 | ports: 14 | - 8080:8080 15 | - 50051:50051 16 | volumes: 17 | - weaviate_data:/var/lib/weaviate 18 | restart: on-failure:0 19 | environment: 20 | TRANSFORMERS_INFERENCE_API: 'http://t2v-transformers:8080' 21 | QUERY_DEFAULTS_LIMIT: 25 22 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 23 | PERSISTENCE_DATA_PATH: '/var/lib/weaviate' 24 | DEFAULT_VECTORIZER_MODULE: 'text2vec-transformers' 25 | ENABLE_MODULES: 'text2vec-transformers' 26 | CLUSTER_HOSTNAME: 'node1' 27 | t2v-transformers: 28 | image: semitechnologies/transformers-inference:snowflake-snowflake-arctic-embed-s 29 | environment: 30 | ENABLE_CUDA: '0' 31 | volumes: 32 | weaviate_data: 33 | ... -------------------------------------------------------------------------------- /weaviate-features/media-search/docker-compose-clip.yaml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | services: 3 | weaviate: 4 | image: cr.weaviate.io/semitechnologies/weaviate:1.25.4 5 | restart: on-failure:0 6 | ports: 7 | - 8080:8080 8 | - 50051:50051 9 | environment: 10 | QUERY_DEFAULTS_LIMIT: 20 11 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 12 | PERSISTENCE_DATA_PATH: "./data" 13 | ENABLE_MODULES: multi2vec-clip 14 | DEFAULT_VECTORIZER_MODULE: multi2vec-clip 15 | CLIP_INFERENCE_API: http://multi2vec-clip:8080 16 | CLUSTER_HOSTNAME: 'node1' 17 | multi2vec-clip: # Set the name of the inference container 18 | image: cr.weaviate.io/semitechnologies/multi2vec-clip:sentence-transformers-clip-ViT-B-32-multilingual-v1 19 | environment: 20 | ENABLE_CUDA: 0 # set to 1 to enable 21 | # Set additional inference containers here if desired 22 | ... -------------------------------------------------------------------------------- /weaviate-features/media-search/docker-compose.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3.4' 3 | services: 4 | weaviate: 5 | command: 6 | - --host 7 | - 0.0.0.0 8 | - --port 9 | - '8080' 10 | - --scheme 11 | - http 12 | image: semitechnologies/weaviate:1.21.8 13 | ports: 14 | - 8080:8080 15 | volumes: 16 | - weaviate_data:/var/lib/weaviate 17 | restart: on-failure:0 18 | environment: 19 | BIND_INFERENCE_API: 'http://multi2vec-bind:8080' 20 | QUERY_DEFAULTS_LIMIT: 25 21 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 22 | PERSISTENCE_DATA_PATH: '/var/lib/weaviate' 23 | DEFAULT_VECTORIZER_MODULE: 'multi2vec-bind' 24 | ENABLE_MODULES: 'multi2vec-bind' 25 | CLUSTER_HOSTNAME: 'node1' 26 | multi2vec-bind: 27 | image: semitechnologies/multi2vec-bind:imagebind 28 | environment: 29 | ENABLE_CUDA: '0' 30 | volumes: 31 | weaviate_data: 32 | ... -------------------------------------------------------------------------------- /weaviate-features/media-search/source/audio/mixkit-big-thunder-with-rain-1291.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/audio/mixkit-big-thunder-with-rain-1291.wav -------------------------------------------------------------------------------- /weaviate-features/media-search/source/audio/mixkit-cartoon-kitty-begging-meow-92.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/audio/mixkit-cartoon-kitty-begging-meow-92.wav -------------------------------------------------------------------------------- /weaviate-features/media-search/source/audio/mixkit-cow-moo-1744.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/audio/mixkit-cow-moo-1744.wav -------------------------------------------------------------------------------- /weaviate-features/media-search/source/audio/mixkit-crowd-laugh-424.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/audio/mixkit-crowd-laugh-424.wav -------------------------------------------------------------------------------- /weaviate-features/media-search/source/audio/mixkit-dog-barking-twice-1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/audio/mixkit-dog-barking-twice-1.wav -------------------------------------------------------------------------------- /weaviate-features/media-search/source/audio/mixkit-jungle-ape-sound-2419.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/audio/mixkit-jungle-ape-sound-2419.wav -------------------------------------------------------------------------------- /weaviate-features/media-search/source/audio/mixkit-little-birds-singing-in-the-trees-17.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/audio/mixkit-little-birds-singing-in-the-trees-17.wav -------------------------------------------------------------------------------- /weaviate-features/media-search/source/audio/mixkit-rain-and-thunder-storm-2390.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/audio/mixkit-rain-and-thunder-storm-2390.wav -------------------------------------------------------------------------------- /weaviate-features/media-search/source/audio/mixkit-rooster-crowing-in-the-morning-2462.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/audio/mixkit-rooster-crowing-in-the-morning-2462.wav -------------------------------------------------------------------------------- /weaviate-features/media-search/source/audio/mixkit-sick-man-sneeze-2213.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/audio/mixkit-sick-man-sneeze-2213.wav -------------------------------------------------------------------------------- /weaviate-features/media-search/source/audio/mixkit-small-group-cheer-and-applause-518.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/audio/mixkit-small-group-cheer-and-applause-518.wav -------------------------------------------------------------------------------- /weaviate-features/media-search/source/image/cat1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/image/cat1.jpg -------------------------------------------------------------------------------- /weaviate-features/media-search/source/image/cat2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/image/cat2.jpg -------------------------------------------------------------------------------- /weaviate-features/media-search/source/image/cat3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/image/cat3.jpg -------------------------------------------------------------------------------- /weaviate-features/media-search/source/image/dog1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/image/dog1.jpg -------------------------------------------------------------------------------- /weaviate-features/media-search/source/image/dog2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/image/dog2.jpg -------------------------------------------------------------------------------- /weaviate-features/media-search/source/image/dog3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/image/dog3.jpg -------------------------------------------------------------------------------- /weaviate-features/media-search/source/image/meerkat1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/image/meerkat1.jpg -------------------------------------------------------------------------------- /weaviate-features/media-search/source/image/meerkat2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/image/meerkat2.jpg -------------------------------------------------------------------------------- /weaviate-features/media-search/source/image/meerkat3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/image/meerkat3.jpg -------------------------------------------------------------------------------- /weaviate-features/media-search/source/video/cat-clean.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/video/cat-clean.mp4 -------------------------------------------------------------------------------- /weaviate-features/media-search/source/video/cat-play.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/video/cat-play.mp4 -------------------------------------------------------------------------------- /weaviate-features/media-search/source/video/dog-high-five.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/video/dog-high-five.mp4 -------------------------------------------------------------------------------- /weaviate-features/media-search/source/video/dog-with-stick.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/video/dog-with-stick.mp4 -------------------------------------------------------------------------------- /weaviate-features/media-search/source/video/meerkat-dig.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/video/meerkat-dig.mp4 -------------------------------------------------------------------------------- /weaviate-features/media-search/source/video/meerkat-watch.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/source/video/meerkat-watch.mp4 -------------------------------------------------------------------------------- /weaviate-features/media-search/test/bird_audio.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/test/bird_audio.wav -------------------------------------------------------------------------------- /weaviate-features/media-search/test/dog_audio.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/test/dog_audio.wav -------------------------------------------------------------------------------- /weaviate-features/media-search/test/test-cat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/test/test-cat.jpg -------------------------------------------------------------------------------- /weaviate-features/media-search/test/test-cat.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/test/test-cat.mp4 -------------------------------------------------------------------------------- /weaviate-features/media-search/test/test-dog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/test/test-dog.jpg -------------------------------------------------------------------------------- /weaviate-features/media-search/test/test-dog.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/test/test-dog.mp4 -------------------------------------------------------------------------------- /weaviate-features/media-search/test/test-meerkat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/test/test-meerkat.jpg -------------------------------------------------------------------------------- /weaviate-features/media-search/test/test-meerkat.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/media-search/test/test-meerkat.mp4 -------------------------------------------------------------------------------- /weaviate-features/media-search/todo.md: -------------------------------------------------------------------------------- 1 | update example to v4 -------------------------------------------------------------------------------- /weaviate-features/multi-vector/Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.org/simple" 3 | verify_ssl = true 4 | name = "pypi" 5 | 6 | [packages] 7 | weaviate-client = "*" 8 | colpali-engine = "*" 9 | jupyter = "*" 10 | datasets = "*" 11 | numpy = "*" 12 | torch = "*" 13 | qwen-vl-utils = "*" 14 | transformers = {git = "https://github.com/huggingface/transformers"} 15 | accelerate = "*" 16 | torchvision = "*" 17 | 18 | [dev-packages] 19 | 20 | [requires] 21 | python_version = "3.13" 22 | -------------------------------------------------------------------------------- /weaviate-features/multi-vector/figures/colipali_pipeline.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/multi-vector/figures/colipali_pipeline.jpeg -------------------------------------------------------------------------------- /weaviate-features/multi-vector/figures/deepseek_efficiency.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/multi-vector/figures/deepseek_efficiency.jpeg -------------------------------------------------------------------------------- /weaviate-features/quantization/product-quantization/docker-compose.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3.4' 3 | services: 4 | weaviate: 5 | command: 6 | - --host 7 | - 0.0.0.0 8 | - --port 9 | - '8080' 10 | - --scheme 11 | - http 12 | image: semitechnologies/weaviate:1.22.3 13 | ports: 14 | - 8080:8080 15 | - 50051:50051 16 | volumes: 17 | - weaviate_data:/var/lib/weaviate 18 | restart: on-failure:0 19 | environment: 20 | QUERY_DEFAULTS_LIMIT: 25 21 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 22 | PERSISTENCE_DATA_PATH: '/var/lib/weaviate' 23 | DEFAULT_VECTORIZER_MODULE: 'none' 24 | ENABLE_MODULES: 'text2vec-cohere,text2vec-huggingface,text2vec-palm,text2vec-openai,generative-openai,generative-cohere,generative-palm,ref2vec-centroid,reranker-cohere,qna-openai' 25 | CLUSTER_HOSTNAME: 'node1' 26 | volumes: 27 | weaviate_data: 28 | ... -------------------------------------------------------------------------------- /weaviate-features/quantization/readme.md: -------------------------------------------------------------------------------- 1 | This repo contains examples of how to use Weaviate's Product and Scalar Quantization to compress vectors! 2 | 3 | Learn more about Weaviate Quantization [here](https://weaviate.io/developers/weaviate/concepts/vector-quantization)! 4 | -------------------------------------------------------------------------------- /weaviate-features/reranking/cohere-ranking/finetune-reranker/azure_openai_usage.log: -------------------------------------------------------------------------------- 1 | Note: NumExpr detected 10 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8. 2 | NumExpr defaulting to 8 threads. 3 | Giving up request(...) after 1 tries (cohere.error.CohereAPIError: invalid api token) 4 | -------------------------------------------------------------------------------- /weaviate-features/reranking/cohere-ranking/finetune-reranker/cohere-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/reranking/cohere-ranking/finetune-reranker/cohere-dashboard.png -------------------------------------------------------------------------------- /weaviate-features/reranking/openai-ranking/listwise.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-features/reranking/openai-ranking/listwise.jpeg -------------------------------------------------------------------------------- /weaviate-features/reranking/todo.md: -------------------------------------------------------------------------------- 1 | update to v4: 2 | * cohere-ranking 3 | * openai-ranking 4 | * voyageai-ranking -------------------------------------------------------------------------------- /weaviate-features/similarity-search/snowflake-embed/docker-compose-t2v-snowflake.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: '3.4' 3 | services: 4 | weaviate: 5 | command: 6 | - --host 7 | - 0.0.0.0 8 | - --port 9 | - '8080' 10 | - --scheme 11 | - http 12 | image: semitechnologies/weaviate:1.24.10 13 | ports: 14 | - 8080:8080 15 | - 50051:50051 16 | volumes: 17 | - weaviate_data:/var/lib/weaviate 18 | restart: on-failure:0 19 | environment: 20 | TRANSFORMERS_INFERENCE_API: 'http://t2v-transformers:8080' 21 | QUERY_DEFAULTS_LIMIT: 25 22 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 23 | PERSISTENCE_DATA_PATH: '/var/lib/weaviate' 24 | DEFAULT_VECTORIZER_MODULE: 'text2vec-transformers' 25 | ENABLE_MODULES: 'text2vec-transformers' 26 | CLUSTER_HOSTNAME: 'node1' 27 | t2v-transformers: 28 | image: semitechnologies/transformers-inference:snowflake-snowflake-arctic-embed-s 29 | environment: 30 | ENABLE_CUDA: '0' 31 | volumes: 32 | weaviate_data: 33 | ... -------------------------------------------------------------------------------- /weaviate-services/agents/README.md: -------------------------------------------------------------------------------- 1 | ## Weaviate Agents 2 | Weaviate Agents are pre-built agentic services designed for specific tasks. 3 | 4 | - Query Agent: Pre-built agentic service designed to answer natural language queries based on the data stored in Weaviate Cloud. 5 | - Transformation Agent: Agentic service designed to augment and transform data using foundation models. 6 | - Personalization Agent: Agentic service designed to return personalized recommendations tailored to each user. 7 | 8 | 9 | 10 | ## Query Agent as a Tool 11 | Learn how to use the Weaviate Query Agent as a tool with LLM SDKs, Agent Frameworks, and Operations Tools. 12 | 13 | | Company name | Solution Type | Notebook Link | 14 | |--------------|-----------------|-----------| 15 | | Anthropic | LLM SDK| [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/function-calling/anthropic/weaviate-query-agent-tool.ipynb) | 16 | | Azure OpenAI | LLM SDK| [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/function-calling/azure-openai/azure-function-calling.ipynb) | 17 | | Baseten | LLM SDK| [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/function-calling/baseten/baseten-query-agent.ipynb) | 18 | | Cohere | LLM SDK| [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/function-calling/cohere/cohere-query-agent-tool.ipynb) | 19 | | Google AI Studio | LLM SDK| [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/function-calling/google-ai-studio/gemini-api-query-agent.ipynb) | 20 | | Google Vertex AI | LLM SDK| [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/function-calling/google-vertex-ai/vertex-ai-query-agent.ipynb) | 21 | | Hugging Face Smolagents | LLM SDK| [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/function-calling/hugging-face-smolagents/smolagents-query-tool.ipynb) | 22 | | NVIDIA | LLM SDK | [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/function-calling/nvidia/nvidia-query-agent-tool.ipynb) | 23 | | Ollama | LLM SDK | [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/function-calling/ollama/ollama-query-agent-tool.ipynb) | 24 | | Together AI | LLM SDK | [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/function-calling/together-ai/together-ai-query-agent.ipynb) | 25 | | Agno | Agent Framework | [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/agno/agno-weaviate-query-agent.ipynb) | 26 | | CrewAI | Agent Framework | [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/crewai/crewai-query-agent-as-tool.ipynb) | 27 | | DSPy | Agent Framework | [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/dspy/agents/simple-query-agent-tool.ipynb) | 28 | | Haystack | Agent Framework| [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/haystack/haystack-query-agent-tool.ipynb) | 29 | | LangChain | Agent Framework | [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/langchain/agents/langchain-weaviate-query-agent.ipynb) | 30 | | LlamaIndex | Agent Framework | [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/llamaindex/agents/agent-workflow-with-weaviate-query-agent-.ipynb) | 31 | | Pydantic | Agent Framework | [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/llm-agent-frameworks/pydantic/pydantic-weaviate-query-tool.ipynb) | 32 | | TruLens | Operations | [Notebook](https://github.com/weaviate/recipes/blob/main/integrations/operations/trulens/query-agent-evaluation-with-trulens.ipynb) | 33 | 34 | ## Documentation 35 | - [Weaviate Agents Introduction](https://weaviate.io/developers/agents) 36 | - [Query Agent](https://weaviate.io/developers/agents/query) 37 | - [Transformation Agent](https://weaviate.io/developers/agents/transformation) 38 | - [Personalization Agent](https://weaviate.io/developers/agents/personalization) 39 | -------------------------------------------------------------------------------- /weaviate-services/agents/images/pod-110-thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-services/agents/images/pod-110-thumbnail.png -------------------------------------------------------------------------------- /weaviate-services/agents/images/synthetic-query-overview-new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weaviate/recipes/4c4ebd78341b246918e6ef6f3be4c1cb33e92e4b/weaviate-services/agents/images/synthetic-query-overview-new.png --------------------------------------------------------------------------------