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
- Navigate to the W&B 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. Version numbers are incrementally assigned to each linked prompt version starting with
v0. - To view details about a prompt version, click the version. From the tabs in this page, you can view that version’s overview, prompt, and use.
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 the W&B 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.