Formatter for inline attributions in chat messages that uses Markdown links.
Methods
__init__(headline_length=None, skip_empty_urls=True)
Initialize the MarkdownLinkInlineAttributionFormatter.
Parameters:
The maximum length of the headline to be displayed in the link.
Whether to skip sources with empty URLs.
Format an inline attribution as a Markdown link.
Parameters:
The index of the attribution within the list of attributions.
Returns:
A string representing the formatted attribution as a Markdown link.
# Import classes from the bigdata-client Python SDK
from bigdata_client import Bigdata
from bigdata_client.models.chat import MarkdownLinkFormatter
formatter = MarkdownLinkFormatter()
# Log in to Bigdata
bigdata = Bigdata("YOUR_USERNAME", "YOUR_PASSWORD")
# Create a new chat with the Markdown formatter
chat = bigdata.chat.new("Pfizer company analysis", formatter=formatter)
# First question
response = chat.ask("Evaluate the experience and reputation of the management team of Pfizer in 2024?", streaming=True)
print(f"\nQuestion:\n - {response.question}")
print(f"\nAnswer:")
for streamingChatInteraction in response:
print(streamingChatInteraction, end="")