Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This package contains Microsoft Azure Discovery client library.
Documentation
Various documentation is available to help you get started
Getting started
Prerequisites
- Java Development Kit (JDK) with version 8 or above
- Azure Subscription
- An existing Microsoft Discovery workspace and/or bookshelf resource, and its service endpoint
Adding the package to your product
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-ai-discovery</artifactId>
<version>1.0.0-beta.1</version>
</dependency>
Authentication
Azure Identity package provides the default implementation for authenticating the client.
Key concepts
The Discovery data-plane library is organized around two service endpoints, each with its own client builder:
- Workspace —
WorkspaceClientBuilderbuilds operation-group clients for a Discovery workspace:ConversationsClient,InvestigationsClient,TasksClient, andToolsClient(each with an asynchronous variant) to manage conversations, investigations, tasks, and long-running tool runs. - Bookshelf —
BookshelfClientBuilderbuildsBookshelfClient/BookshelfAsyncClientto manage knowledge bases, including long-running create/update, indexing, and search.
Each client is created with its service endpoint and a TokenCredential such as DefaultAzureCredential. The Workspace and Bookshelf endpoints are distinct, so build the client that matches the operation you need.
Examples
ConversationsClient conversationsClient = new WorkspaceClientBuilder()
.endpoint("https://<workspace-name>.discovery.azure.com")
.credential(new DefaultAzureCredentialBuilder().build())
.buildConversationsClient();
PagedConversation conversations = conversationsClient.list();
for (Conversation conversation : conversations.getValue()) {
System.out.println(conversation.getName());
}
List knowledge bases with a BookshelfClient:
BookshelfClient bookshelfClient = new BookshelfClientBuilder()
.endpoint("https://<bookshelf-name>.discovery.azure.com")
.credential(new DefaultAzureCredentialBuilder().build())
.buildClient();
for (KnowledgeBase knowledgeBase : bookshelfClient.list()) {
System.out.println(knowledgeBase.getName());
}
Service API versions
The client library targets the latest service API version by default. The service client builder accepts an optional service API version parameter to specify which API version to communicate.
Select a service API version
You have the flexibility to explicitly select a supported service API version when initializing a service client via the service client builder. This ensures that the client can communicate with services using the specified API version.
When selecting an API version, it is important to verify that there are no breaking changes compared to the latest API version. If there are significant differences, API calls may fail due to incompatibility.
Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy.
Troubleshooting
- Authentication — ensure your
TokenCredential(for exampleDefaultAzureCredential) can obtain a token and that the identity has access to the target workspace or bookshelf resource. - Endpoints — Workspace and Bookshelf operations use different endpoints; pointing a client at the wrong endpoint typically results in
403/404responses. - HTTP logging — set
httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))on the client builder to inspect the underlying requests and responses. See the logging wiki for details.
Next steps
- Browse the samples for more usage examples.
- Learn more about Microsoft Discovery.
- Explore the API reference documentation.
Contributing
For details on contributing to this repository, see the contributing guide.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
Azure SDK for Java