### Setup Environment with uv Source: https://github.com/posit-dev/chatlas/blob/main/CLAUDE.md Installs all project dependencies using uv sync with extra features enabled. This command ensures the development environment is correctly set up with all necessary packages. ```Shell make setup ``` -------------------------------- ### Install chatlas from PyPI Source: https://github.com/posit-dev/chatlas/blob/main/README.md Installs the latest stable release of the chatlas library from the Python Package Index (PyPI). This is the recommended method for most users. ```bash pip install -U chatlas ``` -------------------------------- ### Install chatlas from GitHub Source: https://github.com/posit-dev/chatlas/blob/main/README.md Installs the latest development version of the chatlas library directly from its GitHub repository. This is useful for users who want to access the newest features or contribute to the project. ```bash pip install -U git+https://github.com/posit-dev/chatlas ``` -------------------------------- ### Provider Class Structure Example Source: https://github.com/posit-dev/chatlas/blob/main/CLAUDE.md Illustrates the basic structure for a new LLM provider class, inheriting from OpenAIProvider or a base Provider. It shows the constructor and a method for customizing request arguments. ```Python class [Name]Provider(OpenAIProvider): # or Provider if custom def __init__(self, ...): super().__init__(...) # Provider-specific initialization def _chat_perform_args(self, ...): # Customize request parameters if needed kwargs = super()._chat_perform_args(...) # Apply provider-specific modifications return kwargs ``` -------------------------------- ### Python Test Setup for Providers Source: https://github.com/posit-dev/chatlas/blob/main/CLAUDE.md This Python code snippet demonstrates how to set up test files and environment variable skipping for provider-specific tests using pytest. It allows conditional skipping of tests based on an environment variable. ```Python import os import pytest do_test = os.getenv("TEST_[NAME]", "true") if do_test.lower() == "false": pytest.skip("Skipping [Name] tests", allow_module_level=True) ``` -------------------------------- ### Chat Function Signature Example Source: https://github.com/posit-dev/chatlas/blob/main/CLAUDE.md Defines the expected signature for a new chat function corresponding to an LLM provider. It includes parameters for system prompt, model, API key, base URL, seed, and additional keyword arguments. ```Python def Chat[Name]( *, system_prompt: Optional[str] = None, model: Optional[str] = None, api_key: Optional[str] = None, base_url: str = "https://...", seed: int | None | MISSING_TYPE = MISSING, kwargs: Optional["ChatClientArgs"] = None, ) -> Chat["SubmitInputArgs", ChatCompletion]: ``` -------------------------------- ### Create ChatOpenAI Client and Chat Source: https://github.com/posit-dev/chatlas/blob/main/README.md Demonstrates how to initialize a ChatOpenAI client with a specific model and system prompt. It also shows how to register a tool (get_current_weather) and send a user query to the model. ```python from chatlas import ChatOpenAI # Optional (but recommended) model and system_prompt chat = ChatOpenAI( model="gpt-4.1-mini", system_prompt="You are a helpful assistant.", ) # Optional tool registration def get_current_weather(lat: float, lng: float): """Get the current weather for a given location.""" return "sunny" chat.register_tool(get_current_weather) # Send user prompt to the model for a response. chat.chat("How's the weather in San Francisco?") ``` -------------------------------- ### Manage Project Documentation Source: https://github.com/posit-dev/chatlas/blob/main/CLAUDE.md Builds the project's documentation or serves it locally for preview. Documentation is generated using Quarto and quartodoc. ```Shell make docs ``` ```Shell make docs-preview ``` -------------------------------- ### Build Project Package Source: https://github.com/posit-dev/chatlas/blob/main/CLAUDE.md Creates a distributable package for the project, typically placed in the 'dist/' directory. This is used for deployment or sharing the library. ```Shell make build ``` -------------------------------- ### Bash Commands for Validation and Testing Source: https://github.com/posit-dev/chatlas/blob/main/CLAUDE.md This section provides bash commands for validating Python code using pyright and running pytest tests with specific environment variable configurations. It also includes a command to verify successful import of a Chatlas provider. ```Bash uv run pyright chatlas/_provider_[name].py ``` ```Bash TEST_[NAME]=false uv run pytest tests/test_provider_[name].py -v ``` ```Bash uv run python -c "from chatlas import Chat[Name]; print('Import successful')" ``` -------------------------------- ### Perform Type Checking with pyright Source: https://github.com/posit-dev/chatlas/blob/main/CLAUDE.md Runs pyright for static type checking across the project. This helps catch type-related errors before runtime, improving code quality and maintainability. ```Shell make check-types ``` ```Shell uv run pyright ``` -------------------------------- ### Run Tests with pytest Source: https://github.com/posit-dev/chatlas/blob/main/CLAUDE.md Executes the project's test suite using pytest. This command is crucial for verifying the correctness of the codebase and ensuring no regressions have been introduced. ```Shell make check-tests ``` ```Shell uv run pytest ``` -------------------------------- ### Lint and Format Code Source: https://github.com/posit-dev/chatlas/blob/main/CLAUDE.md Checks the code for linting and formatting issues, and optionally fixes them. This ensures code consistency and adherence to project style guidelines. ```Shell make check-format ``` ```Shell make format ``` -------------------------------- ### Execute Full Project Checks Source: https://github.com/posit-dev/chatlas/blob/main/CLAUDE.md Runs a comprehensive set of checks including formatting, type checking, and tests. This command provides a consolidated status of the project's health. ```Shell make check ``` -------------------------------- ### Update Snapshot Tests Source: https://github.com/posit-dev/chatlas/blob/main/CLAUDE.md Updates the golden files (snapshots) used for testing responses with the 'syrupy' library. This is necessary when expected outputs change. ```Shell make update-snaps ``` -------------------------------- ### Run a Specific Test Source: https://github.com/posit-dev/chatlas/blob/main/CLAUDE.md Executes a single test case, potentially within a specific class or method, using pytest. This is useful for targeted debugging. ```Shell uv run pytest tests/test_specific_file.py::TestClass::test_method -v ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.