Skip to content

Instantly share code, notes, and snippets.

@koganei
Last active April 12, 2023 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koganei/73116e0a729a003d8275c51d1cbb496c to your computer and use it in GitHub Desktop.
Save koganei/73116e0a729a003d8275c51d1cbb496c to your computer and use it in GitHub Desktop.
import gradio
import os
store_file_path = "my_faiss_index.faiss"
store_config_file_path = "my_faiss_index.json"
document_external_location = "https://github.com/OldManUmby/DND.SRD.Wiki/archive/refs/heads/master.zip"
"""Setting logging to info"""
import logging
logging.basicConfig(format="%(levelname)s - %(name)s - %(message)s", level=logging.WARNING)
logging.getLogger("haystack").setLevel(logging.INFO)
from haystack.document_stores import FAISSDocumentStore
should_process_files = False
if os.path.exists(store_file_path):
print("loading path")
document_store = FAISSDocumentStore(faiss_index_path=store_file_path, faiss_config_path=store_config_file_path)
else:
document_store = FAISSDocumentStore()
should_process_files = True
"""Load Data"""
if should_process_files:
print("processing files")
from haystack.utils import fetch_archive_from_http
doc_dir = "data/dnd_srd"
fetch_archive_from_http(
url=document_external_location,
output_dir=doc_dir
)
"""Add Data to the DocumentStore"""
from haystack.pipelines.standard_pipelines import TextIndexingPipeline
files_to_index = []
for root, dirs, files in os.walk(doc_dir):
for file in files:
file_path = os.path.join(root, file)
if os.path.isfile(file_path):
files_to_index.append(file_path)
indexing_pipeline = TextIndexingPipeline(document_store)
indexing_pipeline.run_batch(file_paths=files_to_index)
"""Initialize the retriever
"""
from haystack.nodes import EmbeddingRetriever
retriever = EmbeddingRetriever(
document_store=document_store,
embedding_model="sentence-transformers/multi-qa-mpnet-base-dot-v1",
)
if should_process_files:
# Important:
# Now that we initialized the Retriever, we need to call update_embeddings() to iterate over all
# previously indexed documents and update their embedding representation.
# While this can be a time consuming operation (depending on the corpus size), it only needs to be done once.
# At query time, we only need to embed the query and compare it to the existing document embeddings, which is very fast.
document_store.update_embeddings(retriever)
print("saved to" + store_file_path)
document_store.save(index_path=store_file_path)
"""Create pipeline to hook up retriever and reader"""
from haystack.nodes import PromptNode
from haystack.nodes.prompt import PromptTemplate
from ExtractiveQAWithPromptNodePipeline import ExtractiveQAWithPromptNodePipeline
pn = PromptNode(
"gpt-3.5-turbo",
api_key=os.environ["openaikey"],
max_length=256,
default_prompt_template=PromptTemplate(
name="question-answering-with-document-scores",
prompt_text="The following is a question about Dungeons and Dragons 5th Edition. Please answer the following question using the paragraphs below from the Dungeons and Dragons System Reference Document in Markdown format as sources.\n"
"An answer should be short, a few words at most.\n"
"---\n"
"Paragraphs:\n{documents}\n"
"---\n"
"Question: {query}\n\n"
"Instructions: Consider all the paragraphs above and their corresponding scores to generate "
"the answer. While a single paragraph may have a high score, it's important to consider all "
"paragraphs for the same answer candidate to answer accurately.\n\n"
"After having considered all possibilities, the final answer is:\n",
),
)
pipe = ExtractiveQAWithPromptNodePipeline(
retriever,
prompt_node=pn
)
def my_inference_function(question):
import jsonpickle
prediction = pipe.run(
query=question,
params={
"Retriever": {"top_k": 10},
"PromptNode": {"top_k": 1}
}
)
json_prediction = jsonpickle.encode(prediction, unpicklable=False)
return json_prediction
gradio_interface = gradio.Interface(
fn = my_inference_function,
inputs = "text",
outputs = "json",
)
gradio_interface.launch()
from typing import Optional
# from haystack.nodes.question_generator.question_generator import QuestionGenerator
from haystack.nodes.retriever.base import BaseRetriever
from haystack.nodes import PromptNode, Shaper, TopPSampler
from haystack.pipelines.base import Pipeline
from haystack.pipelines.standard_pipelines import BaseStandardPipeline
class ExtractiveQAWithPromptNodePipeline(BaseStandardPipeline):
"""
Pipeline for Extractive Question Answering.
"""
def __init__(
self,
retriever: BaseRetriever,
prompt_node: PromptNode,
sampler: Optional[TopPSampler] = None,
shaper: Optional[Shaper] = None,
):
"""
:param reader: Reader instance
:param retriever: Retriever instance
"""
self.pipeline = Pipeline()
self.pipeline.add_node(component=retriever, name="Retriever", inputs=["HistoryPrompt"])
self.pipeline.add_node(component=prompt_node, name="PromptNode", inputs=["Retriever"])
self.metrics_filter = {"Retriever": ["recall_single_hit"]}
def run(self, query: str, params: Optional[dict] = None, debug: Optional[bool] = None):
"""
:param query: The search query string.
:param params: Params for the `retriever` and `reader`. For instance,
params={"Retriever": {"top_k": 10}, "Reader": {"top_k": 5}}
:param debug: Whether the pipeline should instruct nodes to collect debug information
about their execution. By default these include the input parameters
they received and the output they generated.
All debug information can then be found in the dict returned
by this method under the key "_debug"
"""
output = self.pipeline.run(query=query, params=params, debug=debug)
return output
{
"results": [
"Yes.",
"Yes. \n\nExplanation: The question is not directly addressed in the given paragraphs, but the mention of the sorcerer as a class implies that there are multiple classes in Dungeons and Dragons 5th Edition, including the wizard.",
"Yes.",
"Yes.",
"The paragraphs do not provide an answer to this question.",
"No.",
"The provided paragraphs do not answer the question.",
"Unknown.",
"No.",
"Yes."
],
"invocation_context": {
"query": "Is a wizard a class?",
"documents": [
{
"content": "# Wizard\n\n### Class Features\n\nAs a wizard, you gain the following class features.\n\n",
"content_type": "text",
"score": 0.5641269481475432,
"meta": {
"_split_id": 0,
"vector_id": "2461"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "eb6ceba8c95ca28fb3727fd213323b9a",
"__pydantic_initialised__": true
},
{
"content": "# Sorcerer\n\n### Class Features\n\nAs a sorcerer, you gain the following class features.\n\n",
"content_type": "text",
"score": 0.5554052720192668,
"meta": {
"_split_id": 0,
"vector_id": "2429"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "e89ebeca6c71d0a8a426207802a8a26b",
"__pydantic_initialised__": true
},
{
"content": "The list might also include spells from a feature in that class, such as the Divine Domain feature of the cleric or the Druid Circle feature of the druid. The monster is considered a member of that class when attuning to or using a magic item that requires membership in the class or access to its spell list.\n\nA monster can cast a spell from its list at a higher level if it has the spell slot to do so. For example, a drow mage with the 3rd-level *lightning bolt* spell can cast it as a 5th-level spell by using one of its 5th-level greater or lesser threat than suggested by its challenge rating.\n\n### Psionics\n\nA monster that casts spells using only the power of its mind has the psionics tag added to its Spellcasting or Innate Spellcasting special trait. This tag carries no special rules of its own, but other parts of the game might refer to it. A monster that has this tag typically doesn't require any components to cast its spells.\n\n",
"content_type": "text",
"score": 0.5524107343020722,
"meta": {
"_split_id": 17,
"vector_id": "559"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "4278001ffea298be6fdfb4baa1b95dc",
"__pydantic_initialised__": true
},
{
"content": "The spell slots can have a combined level that is equal to or less than half your wizard level (rounded up), and none of the slots can be 6th level or higher.\n\nFor example, if you're a 4th-level wizard, you can recover up to two levels worth of spell slots. You can recover either a 2nd-level spell slot or two 1st-level spell slots.\n\n### Arcane Tradition\n\nWhen you reach 2nd level, you choose an arcane tradition, shaping your practice of magic through one of eight schools: Abjuration, Conjuration, Divination, Enchantment, Evocation, Illusion, Necromancy, or Transmutation, all detailed at the end of the class description.\n\nYour choice grants you features at 2nd level and again at 6th, 10th, and 14th level.\n\n### Ability Score Improvement\n\nWhen you reach 4th level, and again at 8th, 12th, 16th, and 19th level, you can increase one ability score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, you can't increase an ability score above 20 using this feature.\n\n### Spell Mastery\n\nAt 18th level, you have achieved such mastery over certain spells that you can cast them at will. ",
"content_type": "text",
"score": 0.5521130099495967,
"meta": {
"_split_id": 5,
"vector_id": "1703"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "aa3468b1ac354c59011e9fd56cc7d61b",
"__pydantic_initialised__": true
},
{
"content": "# Cleric\n\n### Class Features\n\nAs a cleric, you gain the following class features.\n\n",
"content_type": "text",
"score": 0.5517691705423039,
"meta": {
"_split_id": 0,
"vector_id": "540"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "4109a78b3f6ca4d5d122afa0648dfd38",
"__pydantic_initialised__": true
},
{
"content": "# Warlock\n\n### Class Features\n\nAs a warlock, you gain the following class features.\n\n",
"content_type": "text",
"score": 0.5512754024665873,
"meta": {
"_split_id": 0,
"vector_id": "1500"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "976de1c2576a36c1f6d4e3dc3c3f6f3a",
"__pydantic_initialised__": true
},
{
"content": "# Druid\n\n### Class Features\n\nAs a druid, you gain the following class features.\n\n",
"content_type": "text",
"score": 0.550773510668181,
"meta": {
"_split_id": 0,
"vector_id": "339"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "303ea778175d72e267b47d76dc0682cd",
"__pydantic_initialised__": true
},
{
"content": "# Bard\n\n### Class Features\n\nAs a bard, you gain the following class features.\n\n",
"content_type": "text",
"score": 0.5501490618085827,
"meta": {
"_split_id": 0,
"vector_id": "393"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "353e1c3beb834736cbeef4702513ce39",
"__pydantic_initialised__": true
},
{
"content": "# Paladin\n\n### Class Features\n\nAs a paladin, you gain the following class features.\n\n",
"content_type": "text",
"score": 0.5498875281992894,
"meta": {
"_split_id": 0,
"vector_id": "198"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "22b2e1d23b974ead08d2c9f1f36f91e",
"__pydantic_initialised__": true
},
{
"content": "It is firmly established in fantasy gaming worlds, with various traditions dedicated to its complex study.\n\nThe most common arcane traditions in the multiverse revolve around the schools of magic. Wizards through the ages have cataloged thousands of spells, grouping them into eight categories called schools. In some places, these traditions are literally schools; a wizard might study at the School of Illusion while another studies across town at the School of Enchantment. In other institutions, the schools are more like academic departments, with rival faculties competing for students and funding. Even wizards who train apprentices in the solitude of their own towers use the division of magic into schools as a learning device, since the spells of each school require mastery of different techniques.\n\n### School of Evocation\n\nYou focus your study on magic that creates powerful elemental effects such as bitter cold, searing flame, rolling thunder, crackling lightning, and burning acid. Some evokers find employment in military forces, serving as artillery to blast enemy armies from afar. Others use their spectacular power to protect the weak, while some seek their own gain as bandits, adventurers, or aspiring tyrants.\n\n",
"content_type": "text",
"score": 0.549460674820644,
"meta": {
"_split_id": 7,
"vector_id": "1711"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "ab29b0999faebdbea15e66393270e028",
"__pydantic_initialised__": true
}
],
"results": [
"Yes.",
"Yes. \n\nExplanation: The question is not directly addressed in the given paragraphs, but the mention of the sorcerer as a class implies that there are multiple classes in Dungeons and Dragons 5th Edition, including the wizard.",
"Yes.",
"Yes.",
"The paragraphs do not provide an answer to this question.",
"No.",
"The provided paragraphs do not answer the question.",
"Unknown.",
"No.",
"Yes."
],
"prompts": [
"The following is a question about Dungeons and Dragons 5th Edition. Please answer the following question using the paragraphs below from the Dungeons and Dragons System Reference Document in Mardown format as sources.\nAn answer should be short, a few words at most.\n---\nParagraphs:\n# Wizard\n\n### Class Features\n\nAs a wizard, you gain the following class features.\n\n\n---\nQuestion: Is a wizard a class?\n\nInstructions: Consider all the paragraphs above and their corresponding scores to generate the answer. While a single paragraph may have a high score, it's important to consider all paragraphs for the same answer candidate to answer accurately.\n\nAfter having considered all possibilities, the final answer is:\n",
"The following is a question about Dungeons and Dragons 5th Edition. Please answer the following question using the paragraphs below from the Dungeons and Dragons System Reference Document in Mardown format as sources.\nAn answer should be short, a few words at most.\n---\nParagraphs:\n# Sorcerer\n\n### Class Features\n\nAs a sorcerer, you gain the following class features.\n\n\n---\nQuestion: Is a wizard a class?\n\nInstructions: Consider all the paragraphs above and their corresponding scores to generate the answer. While a single paragraph may have a high score, it's important to consider all paragraphs for the same answer candidate to answer accurately.\n\nAfter having considered all possibilities, the final answer is:\n",
"The following is a question about Dungeons and Dragons 5th Edition. Please answer the following question using the paragraphs below from the Dungeons and Dragons System Reference Document in Mardown format as sources.\nAn answer should be short, a few words at most.\n---\nParagraphs:\nThe list might also include spells from a feature in that class, such as the Divine Domain feature of the cleric or the Druid Circle feature of the druid. The monster is considered a member of that class when attuning to or using a magic item that requires membership in the class or access to its spell list.\n\nA monster can cast a spell from its list at a higher level if it has the spell slot to do so. For example, a drow mage with the 3rd-level *lightning bolt* spell can cast it as a 5th-level spell by using one of its 5th-level greater or lesser threat than suggested by its challenge rating.\n\n### Psionics\n\nA monster that casts spells using only the power of its mind has the psionics tag added to its Spellcasting or Innate Spellcasting special trait. This tag carries no special rules of its own, but other parts of the game might refer to it. A monster that has this tag typically doesn't require any components to cast its spells.\n\n\n---\nQuestion: Is a wizard a class?\n\nInstructions: Consider all the paragraphs above and their corresponding scores to generate the answer. While a single paragraph may have a high score, it's important to consider all paragraphs for the same answer candidate to answer accurately.\n\nAfter having considered all possibilities, the final answer is:\n",
"The following is a question about Dungeons and Dragons 5th Edition. Please answer the following question using the paragraphs below from the Dungeons and Dragons System Reference Document in Mardown format as sources.\nAn answer should be short, a few words at most.\n---\nParagraphs:\nThe spell slots can have a combined level that is equal to or less than half your wizard level (rounded up), and none of the slots can be 6th level or higher.\n\nFor example, if you're a 4th-level wizard, you can recover up to two levels worth of spell slots. You can recover either a 2nd-level spell slot or two 1st-level spell slots.\n\n### Arcane Tradition\n\nWhen you reach 2nd level, you choose an arcane tradition, shaping your practice of magic through one of eight schools: Abjuration, Conjuration, Divination, Enchantment, Evocation, Illusion, Necromancy, or Transmutation, all detailed at the end of the class description.\n\nYour choice grants you features at 2nd level and again at 6th, 10th, and 14th level.\n\n### Ability Score Improvement\n\nWhen you reach 4th level, and again at 8th, 12th, 16th, and 19th level, you can increase one ability score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, you can't increase an ability score above 20 using this feature.\n\n### Spell Mastery\n\nAt 18th level, you have achieved such mastery over certain spells that you can cast them at will. \n---\nQuestion: Is a wizard a class?\n\nInstructions: Consider all the paragraphs above and their corresponding scores to generate the answer. While a single paragraph may have a high score, it's important to consider all paragraphs for the same answer candidate to answer accurately.\n\nAfter having considered all possibilities, the final answer is:\n",
"The following is a question about Dungeons and Dragons 5th Edition. Please answer the following question using the paragraphs below from the Dungeons and Dragons System Reference Document in Mardown format as sources.\nAn answer should be short, a few words at most.\n---\nParagraphs:\n# Cleric\n\n### Class Features\n\nAs a cleric, you gain the following class features.\n\n\n---\nQuestion: Is a wizard a class?\n\nInstructions: Consider all the paragraphs above and their corresponding scores to generate the answer. While a single paragraph may have a high score, it's important to consider all paragraphs for the same answer candidate to answer accurately.\n\nAfter having considered all possibilities, the final answer is:\n",
"The following is a question about Dungeons and Dragons 5th Edition. Please answer the following question using the paragraphs below from the Dungeons and Dragons System Reference Document in Mardown format as sources.\nAn answer should be short, a few words at most.\n---\nParagraphs:\n# Warlock\n\n### Class Features\n\nAs a warlock, you gain the following class features.\n\n\n---\nQuestion: Is a wizard a class?\n\nInstructions: Consider all the paragraphs above and their corresponding scores to generate the answer. While a single paragraph may have a high score, it's important to consider all paragraphs for the same answer candidate to answer accurately.\n\nAfter having considered all possibilities, the final answer is:\n",
"The following is a question about Dungeons and Dragons 5th Edition. Please answer the following question using the paragraphs below from the Dungeons and Dragons System Reference Document in Mardown format as sources.\nAn answer should be short, a few words at most.\n---\nParagraphs:\n# Druid\n\n### Class Features\n\nAs a druid, you gain the following class features.\n\n\n---\nQuestion: Is a wizard a class?\n\nInstructions: Consider all the paragraphs above and their corresponding scores to generate the answer. While a single paragraph may have a high score, it's important to consider all paragraphs for the same answer candidate to answer accurately.\n\nAfter having considered all possibilities, the final answer is:\n",
"The following is a question about Dungeons and Dragons 5th Edition. Please answer the following question using the paragraphs below from the Dungeons and Dragons System Reference Document in Mardown format as sources.\nAn answer should be short, a few words at most.\n---\nParagraphs:\n# Bard\n\n### Class Features\n\nAs a bard, you gain the following class features.\n\n\n---\nQuestion: Is a wizard a class?\n\nInstructions: Consider all the paragraphs above and their corresponding scores to generate the answer. While a single paragraph may have a high score, it's important to consider all paragraphs for the same answer candidate to answer accurately.\n\nAfter having considered all possibilities, the final answer is:\n",
"The following is a question about Dungeons and Dragons 5th Edition. Please answer the following question using the paragraphs below from the Dungeons and Dragons System Reference Document in Mardown format as sources.\nAn answer should be short, a few words at most.\n---\nParagraphs:\n# Paladin\n\n### Class Features\n\nAs a paladin, you gain the following class features.\n\n\n---\nQuestion: Is a wizard a class?\n\nInstructions: Consider all the paragraphs above and their corresponding scores to generate the answer. While a single paragraph may have a high score, it's important to consider all paragraphs for the same answer candidate to answer accurately.\n\nAfter having considered all possibilities, the final answer is:\n",
"The following is a question about Dungeons and Dragons 5th Edition. Please answer the following question using the paragraphs below from the Dungeons and Dragons System Reference Document in Mardown format as sources.\nAn answer should be short, a few words at most.\n---\nParagraphs:\nIt is firmly established in fantasy gaming worlds, with various traditions dedicated to its complex study.\n\nThe most common arcane traditions in the multiverse revolve around the schools of magic. Wizards through the ages have cataloged thousands of spells, grouping them into eight categories called schools. In some places, these traditions are literally schools; a wizard might study at the School of Illusion while another studies across town at the School of Enchantment. In other institutions, the schools are more like academic departments, with rival faculties competing for students and funding. Even wizards who train apprentices in the solitude of their own towers use the division of magic into schools as a learning device, since the spells of each school require mastery of different techniques.\n\n### School of Evocation\n\nYou focus your study on magic that creates powerful elemental effects such as bitter cold, searing flame, rolling thunder, crackling lightning, and burning acid. Some evokers find employment in military forces, serving as artillery to blast enemy armies from afar. Others use their spectacular power to protect the weak, while some seek their own gain as bandits, adventurers, or aspiring tyrants.\n\n\n---\nQuestion: Is a wizard a class?\n\nInstructions: Consider all the paragraphs above and their corresponding scores to generate the answer. While a single paragraph may have a high score, it's important to consider all paragraphs for the same answer candidate to answer accurately.\n\nAfter having considered all possibilities, the final answer is:\n"
]
},
"documents": [
{
"content": "# Wizard\n\n### Class Features\n\nAs a wizard, you gain the following class features.\n\n",
"content_type": "text",
"score": 0.5641269481475432,
"meta": {
"_split_id": 0,
"vector_id": "2461"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "eb6ceba8c95ca28fb3727fd213323b9a",
"__pydantic_initialised__": true
},
{
"content": "# Sorcerer\n\n### Class Features\n\nAs a sorcerer, you gain the following class features.\n\n",
"content_type": "text",
"score": 0.5554052720192668,
"meta": {
"_split_id": 0,
"vector_id": "2429"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "e89ebeca6c71d0a8a426207802a8a26b",
"__pydantic_initialised__": true
},
{
"content": "The list might also include spells from a feature in that class, such as the Divine Domain feature of the cleric or the Druid Circle feature of the druid. The monster is considered a member of that class when attuning to or using a magic item that requires membership in the class or access to its spell list.\n\nA monster can cast a spell from its list at a higher level if it has the spell slot to do so. For example, a drow mage with the 3rd-level *lightning bolt* spell can cast it as a 5th-level spell by using one of its 5th-level greater or lesser threat than suggested by its challenge rating.\n\n### Psionics\n\nA monster that casts spells using only the power of its mind has the psionics tag added to its Spellcasting or Innate Spellcasting special trait. This tag carries no special rules of its own, but other parts of the game might refer to it. A monster that has this tag typically doesn't require any components to cast its spells.\n\n",
"content_type": "text",
"score": 0.5524107343020722,
"meta": {
"_split_id": 17,
"vector_id": "559"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "4278001ffea298be6fdfb4baa1b95dc",
"__pydantic_initialised__": true
},
{
"content": "The spell slots can have a combined level that is equal to or less than half your wizard level (rounded up), and none of the slots can be 6th level or higher.\n\nFor example, if you're a 4th-level wizard, you can recover up to two levels worth of spell slots. You can recover either a 2nd-level spell slot or two 1st-level spell slots.\n\n### Arcane Tradition\n\nWhen you reach 2nd level, you choose an arcane tradition, shaping your practice of magic through one of eight schools: Abjuration, Conjuration, Divination, Enchantment, Evocation, Illusion, Necromancy, or Transmutation, all detailed at the end of the class description.\n\nYour choice grants you features at 2nd level and again at 6th, 10th, and 14th level.\n\n### Ability Score Improvement\n\nWhen you reach 4th level, and again at 8th, 12th, 16th, and 19th level, you can increase one ability score of your choice by 2, or you can increase two ability scores of your choice by 1. As normal, you can't increase an ability score above 20 using this feature.\n\n### Spell Mastery\n\nAt 18th level, you have achieved such mastery over certain spells that you can cast them at will. ",
"content_type": "text",
"score": 0.5521130099495967,
"meta": {
"_split_id": 5,
"vector_id": "1703"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "aa3468b1ac354c59011e9fd56cc7d61b",
"__pydantic_initialised__": true
},
{
"content": "# Cleric\n\n### Class Features\n\nAs a cleric, you gain the following class features.\n\n",
"content_type": "text",
"score": 0.5517691705423039,
"meta": {
"_split_id": 0,
"vector_id": "540"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "4109a78b3f6ca4d5d122afa0648dfd38",
"__pydantic_initialised__": true
},
{
"content": "# Warlock\n\n### Class Features\n\nAs a warlock, you gain the following class features.\n\n",
"content_type": "text",
"score": 0.5512754024665873,
"meta": {
"_split_id": 0,
"vector_id": "1500"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "976de1c2576a36c1f6d4e3dc3c3f6f3a",
"__pydantic_initialised__": true
},
{
"content": "# Druid\n\n### Class Features\n\nAs a druid, you gain the following class features.\n\n",
"content_type": "text",
"score": 0.550773510668181,
"meta": {
"_split_id": 0,
"vector_id": "339"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "303ea778175d72e267b47d76dc0682cd",
"__pydantic_initialised__": true
},
{
"content": "# Bard\n\n### Class Features\n\nAs a bard, you gain the following class features.\n\n",
"content_type": "text",
"score": 0.5501490618085827,
"meta": {
"_split_id": 0,
"vector_id": "393"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "353e1c3beb834736cbeef4702513ce39",
"__pydantic_initialised__": true
},
{
"content": "# Paladin\n\n### Class Features\n\nAs a paladin, you gain the following class features.\n\n",
"content_type": "text",
"score": 0.5498875281992894,
"meta": {
"_split_id": 0,
"vector_id": "198"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "22b2e1d23b974ead08d2c9f1f36f91e",
"__pydantic_initialised__": true
},
{
"content": "It is firmly established in fantasy gaming worlds, with various traditions dedicated to its complex study.\n\nThe most common arcane traditions in the multiverse revolve around the schools of magic. Wizards through the ages have cataloged thousands of spells, grouping them into eight categories called schools. In some places, these traditions are literally schools; a wizard might study at the School of Illusion while another studies across town at the School of Enchantment. In other institutions, the schools are more like academic departments, with rival faculties competing for students and funding. Even wizards who train apprentices in the solitude of their own towers use the division of magic into schools as a learning device, since the spells of each school require mastery of different techniques.\n\n### School of Evocation\n\nYou focus your study on magic that creates powerful elemental effects such as bitter cold, searing flame, rolling thunder, crackling lightning, and burning acid. Some evokers find employment in military forces, serving as artillery to blast enemy armies from afar. Others use their spectacular power to protect the weak, while some seek their own gain as bandits, adventurers, or aspiring tyrants.\n\n",
"content_type": "text",
"score": 0.549460674820644,
"meta": {
"_split_id": 7,
"vector_id": "1711"
},
"id_hash_keys": [
"content"
],
"embedding": null,
"id": "ab29b0999faebdbea15e66393270e028",
"__pydantic_initialised__": true
}
],
"root_node": "Query",
"params": {
"Retriever": {
"top_k": 10
}
},
"query": "Is a wizard a class?",
"node_id": "PromptNode"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment