Skip to content

Commit

Permalink
Merge pull request #621 from fastai/llms
Browse files Browse the repository at this point in the history
Add llm context files
  • Loading branch information
jph00 authored Sep 12, 2024
2 parents bb91a9e + 7529383 commit c84a5be
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
4 changes: 4 additions & 0 deletions nbs/_quarto.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
project:
type: website
pre-render:
- pysym2md --output_file apilist.txt fastcore # https://github.com/AnswerDotAI/pysymbol-llm
resources:
- "*.txt"
preview:
navigate: false
port: 3000
Expand Down
43 changes: 43 additions & 0 deletions nbs/llms.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# fastcore

fastcore adds to Python features inspired by other languages, like multiple dispatch from Julia, mixins from Ruby, and currying, binding, and more from Haskell. It also adds some “missing features” and clean up some rough edges in the Python standard library, such as simplifying parallel processing, and bringing ideas from NumPy over to Python’s list type.

Here are some tips on using fastcore:

- **Liberal imports**: Utilize `from fastcore.module import *` freely. The library is designed for safe wildcard imports.
- **Enhanced list operations**: Substitute `list` with `L`. This provides advanced indexing, method chaining, and additional functionality while maintaining list-like behavior.
- **Extend existing classes**: Apply the `@patch` decorator to add methods to classes, including built-ins, without subclassing. This enables more flexible code organization.
- **Streamline class initialization**: In `__init__` methods, use `store_attr()` to efficiently set multiple attributes, reducing repetitive assignment code.
- **Explicit keyword arguments**: Apply the `delegates` decorator to functions to replace `**kwargs` with specific parameters, enhancing IDE support and documentation.
- **Optimize parallel execution**: Leverage fastcore's enhanced `ThreadPoolExecutor` and `ProcessPoolExecutor` for simplified concurrent processing.
- **Expressive testing**: Prefer fastcore's testing functions like `test_eq`, `test_ne`, `test_close` for more readable and informative test assertions.
- **Advanced file operations**: Use the extended `Path` class, which adds methods like `ls()`, `read_json()`, and others to `pathlib.Path`.
- **Flexible data structures**: Convert between dictionaries and attribute-access objects using `dict2obj` and `obj2dict` for more intuitive data handling.
- **Data pipeline construction**: Employ `Transform` and `Pipeline` classes to create modular, composable data processing workflows.
- **Functional programming paradigms**: Utilize tools like `compose`, `maps`, and `filter_ex` to write more functional-style Python code.
- **Documentation**: Use `docments` where possible to document parameters of functions and methods.
- **Time-aware caching**: Apply the `timed_cache` decorator to add time-based expiration to the standard `lru_cache` functionality.
- **Simplified CLI creation**: Use fastcore's console script utilities to easily transform Python functions into command-line interfaces.

## Tutorials

- [Fastcore Quick Tour](https://fastcore.fast.ai/tour.html.md): A quick tour of a few higlights from fastcore.
- [Blog Post](https://gist.githubusercontent.com/hamelsmu/ea9e0519d9a94a4203bcc36043eb01c5/raw/6c0c96a2823d67aecc103206d6ab21c05dcd520a/fastcore:_an_underrated_python_library.md): A tour of some of the features of fastcore.

## API

- [API List](https://fastcore.fast.ai/apilist.txt): A succint list of all functions and methods in fastcore.

## Optional

- [fastcore.test](https://fastcore.fast.ai/test.html.md): Simple testing functions
- [fastcore.basics](https://fastcore.fast.ai/basics.html.md): Basic functionality used in the fastai library.
- [fastcore.foundation](https://fastcore.fast.ai/foundation.html.md): The L class and helpers for it
- [fastcore.xtras](https://fastcore.fast.ai/xtras.html.md): Utility functions used in the fastai library
- [fastcore.parallel](https://fastcore.fast.ai/parallel.html.md):parallel processing
- [fastcore.net](https://fastcore.fast.ai/net.html.md): testing utilities
- [fastcore.docments](https://fastcore.fast.ai/docments.html.md): documentation utilities
- [fastcore.meta](https://fastcore.fast.ai/meta.html.md): metaclasses
- [fastcore.script](https://fastcore.fast.ai/script.html.md): CLI script utilities
- [fastcore.xdg](https://fastcore.fast.ai/xdg.html.md): XDG Base Directory Specification helpers.
- [fastcore.xml](https://fastcore.fast.ai/xml.html.md): concise generation of XML
2 changes: 1 addition & 1 deletion settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ license = apache2
status = 5
nbs_path = nbs
doc_path = _docs
dev_requirements = numpy nbdev>=0.2.39 matplotlib pillow torch pandas nbclassic
dev_requirements = numpy nbdev>=0.2.39 matplotlib pillow torch pandas nbclassic pysymbol_llm
git_url = https://github.com/fastai/fastcore/
lib_path = fastcore
title = fastcore
Expand Down
3 changes: 3 additions & 0 deletions tools/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
llms_txt2ctx nbs/llms.txt > nbs/llms-ctx-full.txt # https://github.com/answerdotai/llms-txt
llms_txt2ctx nbs/llms.txt --optional false > nbs/llms-ctx.txt

0 comments on commit c84a5be

Please sign in to comment.