> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bigdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat

<Warning>
  We are sunsetting our SDKs and will no longer add new features, security patches, bug fixes, or technical support for them. To access the latest capabilities and ongoing improvements, we encourage you to migrate to our [RESTful API](/api-rest/introduction).

  SDK support will officially end on **December 31, 2026**. On this date, the underlying endpoints used by the SDKs and related documentation will be decommissioned.

  To avoid any disruption to your services, please ensure your migration is complete by that date.

  For migration assistance, please contact us at [support@bigdata.com](mailto:support@bigdata.com).
</Warning>

Represents a chat session that can handle user interactions.

## Methods

### `ask(question, *, scope=None, formatter=None, streaming=False)`

Ask a question in the chat.

**Parameters:**

<ParamField query="question" type="string" required>
  The question to ask.
</ParamField>

<ParamField query="scope" type="ChatScope | None">
  The scope of the chat interaction: [ChatScope](./chatScope)
</ParamField>

<ParamField query="formatter" type="InlineAttributionFormatter | None">
  Format of the response inline attributions: [InlineAttributionFormatter](./inlineAttributionFormatter)
</ParamField>

<ParamField query="streaming" type="bool">
  Whether to stream the response.
</ParamField>

<ParamField query="source_filter" type="list[Source] | list[str] | None = None">
  Provide a list of trusted sources to ground the response. Check [Find Sources](../../getting-started/knowledge_graph/find_sources) to learn how to curate a list of trusted sources.

  You can either provide the list of `Source` Objects directly from the response of the method `find_sources` or the list of source IDs.
</ParamField>

```python highlight="16" theme={null}
# Import classes from the bigdata-client Python SDK        
from bigdata_client import Bigdata

# Log in to Bigdata
bigdata = Bigdata("YOUR_USERNAME", "YOUR_PASSWORD")

# Create a new chat
chat = bigdata.chat.new("Companies in quantum computing")

# Get source by name
sources = bigdata.knowledge_graph.find_sources("Bloomberg News")
print(sources)

# Ask a question with source filtering, so the response will contain data from your specified trusted sources.
response = chat.ask("Companies involved in quantum computing", source_filter=sources, streaming=True)	

print(f"\nQuestion:\n - {response.question}")
print(f"\nAnswer:")
for streamingChatInteraction in response:
  print(streamingChatInteraction, end="")

print(f"\nDocuments used to craft the Chat response:\n")
for source in response.sources:
    print(f"\tDocument ID: {source.id}")
    print(f"\tHeadline: {source.headline}")
    print(f"\tURL: {source.url}\n")
```

The output of the above script will contain:

* The selected source:

```output theme={null}
[Source(id='208421', name='Bloomberg News', volume=None, description='Bloomberg News is an international news agency headquartered in New York,
 United States and a division of Bloomberg L.P.', entity_type='SRCE', publication_type='News', language='English', country='US', source_rank='1',
  retention=<SourceRetentionPeriod.FIVE_YEARS: '5Y'>, provider_id='MRVR', url='http://www.bloomberg.com')]
```

* Chat question and answer:

```output theme={null}
Question:
 - Companies involved in quantum computing research

Answer:
Several companies are actively involved in quantum computing research and development:

*   **Alphabet Inc.'s Google** is designing quantum computing processors and has developed a quantum chip called Willow. Google is also an investor in quantum startups like QuEra. `:ref[0]` `:ref[0]` `:ref[2]` `:ref[3]`  
*   **Nvidia Corp.** is collaborating with Google's Quantum AI division, using its Eos supercomputer to accelerate the design of quantum components. `:ref[0]` `:ref[0]`  
*   **Riverlane**, a startup based in Cambridge, England, and Boston, designs chips to correct errors in quantum computation. `:ref[1]` `:ref[1]`  
...
..
.

```

* And the list of documents used to ground the response, where we see that all of them are from the specified source.

```output theme={null}
Document ID: 5BF7D46754A1E8B4BFC1D0B10F6F9236
  Headline: Nvidia Is Helping Google Design Quantum Computing Processors
  URL: https://news.bloomberglaw.com/tech-and-telecom-law/nvidia-is-helping-google-design-quantum-computing-processors

Document ID: F724276362346324C10D6FF0185BF5A6
  Headline: Quantum Computing Startup Riverlane Raises $75 Million
  URL: None

Document ID: 91C73FC9040D21CCD8BB9571950B5A0D
  Headline: Is Quantum Computing Finally Becoming a Reality?: Editorial
  URL: https://news.bloomberglaw.com/ip-law/is-quantum-computing-finally-becoming-a-reality-editorial
...
..
.
```

**Return type:**

[ChatInteraction](./chatInteraction) | [StreamingChatInteraction](./streamingChatInteraction)

### `delete()`

Delete the chat.

## Fields

<ParamField query="id" type="string" required>
  Unique identifier for the chat.
</ParamField>

<ParamField query="name" type="string" required>
  Name of the chat.
</ParamField>

<ParamField query="user_id" type="string" required>
  Identifier of the user who created the chat.
</ParamField>

<ParamField query="date_created" type="datetime" required>
  Datetime when the chat was created.
</ParamField>

<ParamField query="last_updated" type="datetime" required>
  Datetime when the chat was last updated.
</ParamField>

<ParamField query="interactions" type="list[ChatInteraction]">
  List of interactions in the chat: [ChatInteraction](./chatInteraction)
</ParamField>
