You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposal: Could we create new functions for wrapping generative capabilities? With:
Mandatoryprompt and model parameters
Optionalsearch_results parameters from Weaviate
This will allow a user to :
Prompt an LLM (without additional retrieved data)
Perform RAG from a Weaviate search response
Perform RAG from multiple Weaviate search responses
Pre-process to formulate a custom LLM prompt
Syntax proposal:
importweaviatefromweaviate.classes.configimportGenerativefromweaviate.classes.generateimportgenerate_textclient=weaviate.connect_to_local()
gen_model=Generative.aws(
model="cohere.command-text-v14",
region="us-east-1"
),
# 💡 >>> SCENARIO 1 <<< Standalone LLM promptresponse=generate_text(
model=gen_model,
prompt="What is the capital of France?",
)
# 💡 >>> SCENARIO 2 <<< RAG with a Weaviate responsewiki=client.collections.get("Wiki")
search_response=wiki.query.hybrid("Afrian or European swallow")
response=generate_text(
model=gen_model,
prompt="Could a swallow carry a coconut?",
search_response=search_response
)
# 💡 >>> SCENARIO 3 <<< RAG with TWO Weaviate responses!wiki=client.collections.get("Wiki")
scripts=client.collections.get("Scripts")
wiki_response=wiki.query.hybrid("Afrian or European swallow")
scripts_response=scripts.query.hybrid("Afrian or European swallow")
response=generate_text(
model=gen_model,
prompt="Could a swallow carry a coconut?",
search_response=[wiki_response, scripts_response]
)
# 💡 >>> SCENARIO 4 <<< RAG with transformed textwiki=client.collections.get("Wiki")
search_response=wiki.query.hybrid("Afrian or European swallow")
context="\n\n".join([f'{o["title"]}: {o["chunk"]}'foroinsearch_response.objects])
response=generate_text(
model=gen_model,
prompt="Could a swallow carry a coconut? Answer based on the following information:\n\n"+context,
)
The text was updated successfully, but these errors were encountered:
Proposal: Could we create new functions for wrapping generative capabilities? With:
This will allow a user to :
Syntax proposal:
The text was updated successfully, but these errors were encountered: