Before you start, check the following:
- The object types that collection permits. For more information about collection types, see “Collection types” within Create a collection.
- The registry that the collection belongs to already exists. To check that the registry exists, navigate to the Registry App and search for the name of the registry.
- Initialize a Weave client with
weave.init(). - Create a Weave prompt object with a built-in prompt class such as
weave.StringPrompt(). - Publish the prompt to Weave with
weave.publish(). - Link the published prompt version to a collection in a registry with
weave_client.link_prompt_to_registry(). Pass the destination collection path to thetarget_pathparameter. The path consists of thewandb-registry-prefix, the registry name, and the collection name:
<> with your own:
View linked prompts in a registry
View the content, usage instructions, and Registry details for a linked prompt version. Each linked prompt version includes the following tabs:
To view a linked prompt in a registry:
- Navigate to Registry.
- Select the name of the registry that you linked the prompt to.
- Select the name of the collection. This expands the list of prompt versions within the collection.
- Select a version.
The information displayed for a linked prompt version differs from that for a linked artifact version.
Use a prompt linked to a registry
Use theweave.get() method to retrieve a prompt object linked to a registry. You can fetch a prompt by its alias or version number. The following code snippet shows how to fetch a prompt by its alias and version number.
To fetch a prompt object by its alias, use the following URI path:
<> with your own:
- Fetch by alias
- Fetch by version
- Navigate to Registry.
- Select the name of the registry that you linked the prompt to.
- Select the name of the collection.
- From the list of prompt versions, select the version you want to access.
- Select the Use tab to view the sample code to fetch your prompt by alias or version number.