# Import classes from the bigdata-client Python SDK from bigdata_client import Bigdatafrom bigdata_client.models.chat import MarkdownLinkFormatterfrom bigdata_client.models.chat import ChatScope# Log in to Bigdatabigdata = Bigdata("YOUR_USERNAME", "YOUR_PASSWORD")# Create a new chat with a format for the inline attribution in reponsesformatter = MarkdownLinkFormatter()chat = bigdata.chat.new("Pfizer company analysis", formatter)# First questionresponse = chat.ask("Evaluate the experience and reputation of the management team of Pfizer in 2024", streaming=True, scope=ChatScope.NEWS)print(f"\nQuestion:\n - {response.question}")print(f"\nAnswer:")for streamingChatInteraction in response: print(streamingChatInteraction, end="")# Follow up questionresponse = chat.ask("Has it hired any senior AI expert?", streaming=True, scope=ChatScope.NEWS)print(f"\nQuestion:\n - {response.question}")print(f"\nAnswer:")for streamingChatInteraction in response: print(streamingChatInteraction, end="")# Delete chatbigdata.chat.delete(chat.id)
Chat service classes
ChatService
Copy
Ask AI
# Import classes from the bigdata-client Python SDK from bigdata_client import Bigdatafrom bigdata_client.models.chat import MarkdownLinkFormatterfrom bigdata_client.models.chat import ChatScope# Log in to Bigdatabigdata = Bigdata("YOUR_USERNAME", "YOUR_PASSWORD")# Create a new chat with a format for the inline attribution in reponsesformatter = MarkdownLinkFormatter()chat = bigdata.chat.new("Pfizer company analysis", formatter)# First questionresponse = chat.ask("Evaluate the experience and reputation of the management team of Pfizer in 2024", streaming=True, scope=ChatScope.NEWS)print(f"\nQuestion:\n - {response.question}")print(f"\nAnswer:")for streamingChatInteraction in response: print(streamingChatInteraction, end="")# Follow up questionresponse = chat.ask("Has it hired any senior AI expert?", streaming=True, scope=ChatScope.NEWS)print(f"\nQuestion:\n - {response.question}")print(f"\nAnswer:")for streamingChatInteraction in response: print(streamingChatInteraction, end="")# Delete chatbigdata.chat.delete(chat.id)
It provides methods to interact with Chat objects, and is accesible from a Bigdata instance
# Import classes from the bigdata-client Python SDK from bigdata_client import Bigdatafrom bigdata_client.models.chat import MarkdownLinkFormatterfrom bigdata_client.models.chat import ChatScope# Log in to Bigdatabigdata = Bigdata("YOUR_USERNAME", "YOUR_PASSWORD")# Create a new chat with a format for the inline attribution in reponsesformatter = MarkdownLinkFormatter()chat = bigdata.chat.new("Pfizer company analysis", formatter)# First questionresponse = chat.ask("Evaluate the experience and reputation of the management team of Pfizer in 2024", streaming=True, scope=ChatScope.NEWS)print(f"\nQuestion:\n - {response.question}")print(f"\nAnswer:")for streamingChatInteraction in response: print(streamingChatInteraction, end="")# Follow up questionresponse = chat.ask("Has it hired any senior AI expert?", streaming=True, scope=ChatScope.NEWS)print(f"\nQuestion:\n - {response.question}")print(f"\nAnswer:")for streamingChatInteraction in response: print(streamingChatInteraction, end="")# Delete chatbigdata.chat.delete(chat.id)