This repository contains a collection of Jupyter notebooks demonstrating how to use the Writer Python SDK for various AI-related tasks. These notebooks provide practical examples and tutorials for working with our models and services, including model retrieval, text and chat completion, knowledge graph manipulation, and more.
- Python 3.7 or higher
- Jupyter Notebook or JupyterLab
- pip (Python package installer)
- A Writer API key (# for free, then follow this Quickstart)
Feel free to simply copy and paste the code snippets in the notebooks. If you prefer to run the cookbooks locally, follow these steps:
-
Clone this repository:
git clone https://github.com/writer/cookbooks.git cd cookbooks
-
Create and activate a virtual environment:
python -m venv my_env source my_env/bin/activate # On Windows, use `my_env\Scripts\activate`
-
Once you have an API key, we recommend that you store it as an environment variable in a
.env
file like so:WRITER_API_KEY="{Your Writer API key goes here}"
-
Ensure your virtual environment is activated.
-
Start Jupyter Notebook or JupyterLab:
jupyter notebook
or
jupyter lab
-
Navigate to the notebook you want to run and open it.
-
Follow the instructions within each notebook to execute the cells and interact with the AI SDK.
-
When you’re done using the notebooks, deactivate the virtual environment:
deactivate
- Models (
/models
)model_retrieval.ipynb
: Demonstrates how to retrieve and list available models.
- Completion (
/completion
)text_completion.ipynb
: Shows how to use the Writer SDK for text completion tasks.chat_completion.ipynb
: Explores chat-based interactions.
- Knowledge Graphs (
/knowledge_graph
)knowledge_graph.ipynb
: Introduces the basics of working with files and Knowledge Graphs.
- Tool calling (
/tool_calling
)tool_calling_api.ipynb
: Introduces the basics of tooling calling and how to use the Writer SDK for tool calling tasks.tool_calling_streaming.ipynb
: Shows how to use tool calling with streaming responses.tool_calling_math.ipynb
: Shows how to use tool calling to solve a math problem.
- Writer developer docs - more guides and tutorials can be found here
- Writer Framework - our open-source Python framework for rapidly building AI apps
- Writer Framework sample apps - example applications built using the Writer Framework
- Writer Python SDK
- Writer Node SDK
Writer is the full-stack generative AI platform for enterprises. Quickly and easily build and deploy AI apps with a suite of developer tools fully integrated with our LLMs, graph-based RAG, AI guardrails, and more. To learn more, visit our website.
If you encounter any issues or have questions, please file an issue on this repository.