Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get/set API to the Context and make it coroutine-safe #15152

Merged
merged 5 commits into from
Aug 16, 2024

Conversation

masci
Copy link
Member

@masci masci commented Aug 5, 2024

Description

  • Introduce get and set APIs and make them coroutine-safe
  • Hide the actual storage data structures, so that the context can be implemented differently without breaking changes
  • Introduce the concept of "private storaging" for data that shouldn't be shared across different steps

Fixes #15276

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Added new unit/integration tests
  • Added new notebook (that tests end-to-end)
  • I stared at the code and made sure it makes sense

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added Google Colab support for the newly added notebooks.
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I ran make format; make lint to appease the lint gods

@masci masci changed the title make the Context coroutine-safe Add get/set API to the Context and make it coroutine-safe Aug 12, 2024
@masci masci marked this pull request as ready for review August 12, 2024 16:03
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 12, 2024
Copy link
Collaborator

@logan-markewich logan-markewich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me 👍🏻

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 15, 2024
@logan-markewich logan-markewich self-assigned this Aug 15, 2024
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Aug 16, 2024
@masci masci merged commit 5005010 into main Aug 16, 2024
8 checks passed
@masci masci deleted the massi/safe-context branch August 16, 2024 19:36
nerdai pushed a commit that referenced this pull request Aug 16, 2024
* make the Context coroutine-safe

* remove parent property

* change API

* docs

* use context manager and add unit tests
nerdai pushed a commit that referenced this pull request Aug 17, 2024
* make the Context coroutine-safe

* remove parent property

* change API

* docs

* use context manager and add unit tests
nerdai pushed a commit that referenced this pull request Aug 17, 2024
* make the Context coroutine-safe

* remove parent property

* change API

* docs

* use context manager and add unit tests
nerdai pushed a commit that referenced this pull request Aug 17, 2024
* make the Context coroutine-safe

* remove parent property

* change API

* docs

* use context manager and add unit tests
nerdai pushed a commit that referenced this pull request Aug 17, 2024
* make the Context coroutine-safe

* remove parent property

* change API

* docs

* use context manager and add unit tests
nerdai pushed a commit that referenced this pull request Aug 17, 2024
* make the Context coroutine-safe

* remove parent property

* change API

* docs

* use context manager and add unit tests
nerdai added a commit that referenced this pull request Aug 20, 2024
* update to v2

* update deps, fix __modify_schema__

* model_validator instead of root_validator

* field_validator over validator

* TypeAdapter over parse_obj_as

* wip model_dump_json over json

* wip

* wip

* move private vars after super init

* move private vars after super init

* populate_by_name over allow_population_by_field_name

* add str(v) in legacy_json_to_doc of docstore/utils module

* add Annotated types

* use annotation

* transformations passing

* pydantic annotations module

* more callback fixes

* update lock

* dict shouldn't use by_alias

* add default callables

* add default callables

* wip llms

* annotations for LLMs to add class name in model_dump

* add model_validator to LLM

* update __pydantic_private__

* make callback manager optional for llms

* add field_serialization

* add field_serialization

* in favor of definitions

* fix pydantic validation errors

* fix dict interface

* pants

* try typing_extensions

* fix optimum

* fix optimum

* 15275 feature request make all events accessible like mappings (#15310)

* add DictLikeEvent

* remove test event

* cr

* cr

* feat: make send_event assign the target step (#15259)

* feat: make send_event assign the target step

* fix: change exception type and add else block

* use __private_attributes__

* bug: Semantic double merging splitter creates chunks larger thank chunk size (#15188)

fix bug with semantic double merging splitter creating chunks larger than max_chunk_size

Co-authored-by: Konrad Rucińsk <konrad.rucinski@bitpeak.pl>

* Update code_hierarchy.py adding php support (#15145)

* Update code_hierarchy.py adding php support

* Update code_hierarchy.py fixing linting error

* Update pyproject.toml bumping version

* test core only

* revert back integration changes

* fix annotations

* impl __get_pydantic_core_schema__ and __get_pydantic_json_schema__ for BaseOutputParser

* impl __get_pydantic_core_schema__ and __get_pydantic_json_schema__ for CallbackManager

* use CallbackManager instead of Annotation

* cleanup

* remove pydantic_annotations module

* remove deprecated BaseConfig from pydantic bridge

* chore: bump deprecated actions (#15331)

bump deprecated actions

* chore: let dependabot monitor Github actions (#15360)

let dependabot monitor Github actions

* chore(deps): bump github/codeql-action from 2 to 3 (#15369)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump JRubics/poetry-publish from 1.17 to 2.0 (#15370)

* Add citation query engine with workflows (#15372)

* Add citation query engine with workflows

* Add descriotion, cookbook link, google colab

* decouple ingest from workflows

* Update description

* Add docstring for create_citations_nodes function

* GCSReader: Implementing ResourcesReaderMixin and FileSystemReaderMixin (#15365)

* fix bug when caling llama-index-postprocessor-dashscope-rerank (#15358)

* update HF's completion_to_prompt (#15354)

* Feat: Wrapper for SambaNova (Sambaverse and SambaStudio) with Llama-index (#15220)

* v0.10.66 (#15403)

* Add JSONAlyze Query Engine using workflows cookbook (#15408)

* Add JSONAlyze Query Engine

* Update with review

* Use backticks to escape label (#15324)

* update pydantic dep

* Fixed issue #15414 and added ability to do partial matchfor Neptune Analytics (#15415)

* escape json in structured llm (#15404)

* update completion_to_prompt of HF pipeline (#15437)

* Fix missing 'self' in example notebook. (#15429)

* Add workaround for Handling MySQL Protocol Limitations in TiDB Vector with insert_batch_size (#15428)

* Cleanlab's cookbook (#15352)

* When building a vector store with use_async=True it doesn't set a TTL on records (#15333)

* Vertexai embedding enhancement (#15367)

* feat: add tool calling for cohere (#15144)

* Add get/set API to the Context and make it coroutine-safe (#15152)

* make the Context coroutine-safe

* remove parent property

* change API

* docs

* use context manager and add unit tests

* Fix LangChainDeprecationWarning (#15397)

* Update langchain.py

fix LangChainDeprecationWarning of ChatMessageHistory

* Fix LangChainDeprecationWarning 

Handling different versions

* Fix LangChainDeprecationWarning 

fix changes

* fix linting

* Ports over LongRAGPack, Corrective RAG Pack, and Self-Discover Pack to Workflows (#15160)

* settings, secret, and start using SerializeAsAny

* wip

* serialize as any T

* wip, SerializeAsAny

* wip, SerializeAsAny

* wip, SerializeAsAny

* chore: remove leftover occurences of `GradientFinetuneEngine` (#15456)

* Exposed NeptuneQueryException and added additional debug information (#15448)

* docs: promote openllmetry to one-click integration (#15443)

* feat: Integrating Azure OpenAI Finetuning (#15297)

* avoid nltk 3.9 since its broken (#15473)

* Add GigaChat embedding (#15278)

* feat: support to configure the base url of jina.ai (#15431)

* Enhance PreprocessReader (#15302)

* v0.10.67 (#15474)

* wip, SerializeAsAny

* GenericModel, ValidationError import, model_rebuild

* handle warning of protected  prefix on fields

* wip ConfigDict

* use ollama client for embeddings (#15478)

* wip ConfigDict

* gte, lte

* Bug-15158: Fixing the issues in loading file paths (#15311)

* Bug-15158: Fixing the issues in loading file paths

* Bump up the version in pyproject.toml

* Add llama-index-graph-stores-neo4j dependency in GraphRAG v2 (#15479)

Signed-off-by: Hollow Man <hollowman@opensuse.org>

* wip model_dump over dict

* model_dump over dict

* llm_rerank conflict

* model_json_dump over dict and model_copy over copy

* model_validate over parse_obj

* model_validate_json over parse_raw

* model_dump_json over json

* wip

* revert to see if breaking

* add back previous changes with fixed BUILD

* make default_id_func serializable

* remove type param from Field

* make CallbackManager not optional

* implement model_serializer to override model_dump for nested classes

* implement model_serializer to override model_dump for nested classes

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Hollow Man <hollowman@opensuse.org>
Co-authored-by: Lin Chia Cheng <74391293+Tonyrj3268@users.noreply.github.com>
Co-authored-by: Konrad Ruciński <46794180+rucinsk1@users.noreply.github.com>
Co-authored-by: Konrad Rucińsk <konrad.rucinski@bitpeak.pl>
Co-authored-by: Joe Huss <detain@interserver.net>
Co-authored-by: Massimiliano Pippi <mpippi@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ravi Theja <ravi03071991@gmail.com>
Co-authored-by: Chetan Choudhary <chetanchoudhary975@gmail.com>
Co-authored-by: afalf <101537385+afalf@users.noreply.github.com>
Co-authored-by: Ethan Yang <ethan.yang@intel.com>
Co-authored-by: pradeep-suresh2002 <124234409+pradeep-suresh2002@users.noreply.github.com>
Co-authored-by: Logan <logan.markewich@live.com>
Co-authored-by: Ian Robinson <iansrobinson@gmail.com>
Co-authored-by: bechbd <bechbd@users.noreply.github.com>
Co-authored-by: Jerry Liu <jerryjliu98@gmail.com>
Co-authored-by: Ali Abbasi <abbasi.ali.tab@gmail.com>
Co-authored-by: Ian <ArGregoryIan@gmail.com>
Co-authored-by: Ashish Sardana <ashishsardana21@gmail.com>
Co-authored-by: mvaquero-atlasti <147490466+mvaquero-atlasti@users.noreply.github.com>
Co-authored-by: Sagar Jadhav <108457149+sagarjadhavcalsoft@users.noreply.github.com>
Co-authored-by: Anirudh31415926535 <anirudh@cohere.com>
Co-authored-by: guodong <songoodong@163.com>
Co-authored-by: Jonathan Liu <81734282+jonathanhliu21@users.noreply.github.com>
Co-authored-by: Nir Gazit <nirga@users.noreply.github.com>
Co-authored-by: Dongwoo Jeong <dongwoo.jeong@lge.com>
Co-authored-by: Kirill <58888049+KirillKukharev@users.noreply.github.com>
Co-authored-by: Cheese <qizhi.wang@pingcap.com>
Co-authored-by: preprocess-co <137915090+preprocess-co@users.noreply.github.com>
Co-authored-by: ReviewBuddy <91291176+pitchdarkdata@users.noreply.github.com>
Co-authored-by: ℍ𝕠𝕝𝕝𝕠𝕨 𝕄𝕒𝕟 <hollowman@opensuse.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files. topic:workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Better API for Context
2 participants