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

feat(models)!: openAI 1.0 #1716

Merged
merged 64 commits into from
Nov 10, 2023
Merged

feat(models)!: openAI 1.0 #1716

merged 64 commits into from
Nov 10, 2023

Conversation

mikeldking
Copy link
Contributor

@mikeldking mikeldking commented Nov 7, 2023

resolves #1715

Updates everything to OpenAI 1.0

  • make llm_classify work
  • make test_classify pass @mikeldking
  • Extend notebooks to validate function calling @mikeldking
  • split out Azure OpenAI for evals
  • change openAI instrumentation to work with OpenAI 1.0 @axiomofjoy
  • migrate us off of requests and responses @anticorrelator

Documentation

  • update request_timeout parameter

Manual tests

  • test function calling

Regression Testing

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@mikeldking mikeldking marked this pull request as draft November 8, 2023 18:19
mikeldking and others added 15 commits November 10, 2023 07:38
Co-authored-by: Xander Song <axiomofjoy@gmail.com>
Co-authored-by: Xander Song <axiomofjoy@gmail.com>
Co-authored-by: Xander Song <axiomofjoy@gmail.com>
Co-authored-by: Xander Song <axiomofjoy@gmail.com>
Co-authored-by: Xander Song <axiomofjoy@gmail.com>
Co-authored-by: Xander Song <axiomofjoy@gmail.com>
Co-authored-by: Xander Song <axiomofjoy@gmail.com>
Co-authored-by: Xander Song <axiomofjoy@gmail.com>
Co-authored-by: Xander Song <axiomofjoy@gmail.com>
Co-authored-by: Xander Song <axiomofjoy@gmail.com>
Co-authored-by: Xander Song <axiomofjoy@gmail.com>
Copy link
Contributor

@axiomofjoy axiomofjoy left a comment

Choose a reason for hiding this comment

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

lgtm

@axiomofjoy axiomofjoy marked this pull request as ready for review November 10, 2023 18:05
Comment on lines +102 to +103
with patch.object(OpenAIModel, "_init_tiktoken", return_value=None):
model = OpenAIModel(max_retries=0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why need to patch this method here but not elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I know the other places you are referring to but the unfortunate side-effect is that tiktoken makes network calls so it fails in an isolated CI env. Yet another reason we probably shouldn't have this initialization as part of the construction process, let alone maybe be a part of the model.

Copy link
Contributor

@anticorrelator anticorrelator left a comment

Choose a reason for hiding this comment

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

Instantiating an azure model fails if an openai key is not detected (I'm not sure we need one if using the azure endpoint)

Copy link
Contributor

@anticorrelator anticorrelator left a comment

Choose a reason for hiding this comment

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

went over implementation with @mikeldking

@mikeldking mikeldking merged commit 2564521 into main Nov 10, 2023
7 checks passed
@mikeldking mikeldking deleted the open-ai-1 branch November 10, 2023 21:18
mikeldking added a commit that referenced this pull request Nov 13, 2023
* git output via openai migrate

* WIP

* git output via openai migrate

WIP

* get pytests running

* get pytests running

* completions changes

* fix llm_classify tests

* fix llm generate tests

* minimal test for openai

* fix llama_index tests

* add back model

* fix openai

* fix openai tests

* Add explanations section for relevance

* run GPT4-Turbo

* update notebooks

* migrate find clusters notebook

* update more notebooks

* fix relevance

* fix tutorials/llm_generative_gpt_4.ipynb

* add more tutorials

* Start refactoring httpx tests to be order-agnostic

* Finish refactoring classification tests

* Refactor `generate` tests to be order-agnostic

* Migrate to respx for langchain tracer tests

* Update openai tracing tests to use respx

* feat(evals): azure openai support

* address pr comments

* return early  for azure

* fix tiktoken failures

* remove model name aliasing

* make gpt-4 point to latest

* ruff format

* docs: update documentation

* feat: update OpenAIInstrumentor to support openai>=1.0.0 and deprecate support for openai<1.0.0 (#1723)

* correct unit test to mock completions endpoint (#1730)

* Update langchain_pinecone_search_and_retrieval_tutorial.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update llama_index_search_and_retrieval_tutorial.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update llm_generative_gpt_4.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update milvus_llamaindex_search_and_retrieval_tutorial.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update ragas_retrieval_evals_tutorial.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update langchain_agent_tracing_tutorial.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update langchain_tracing_tutorial.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update llama_index_openai_agent_tracing_tutorial.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update llama_index_tracing_tutorial.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update langchain_retrieval_qa_with_sources_chain_tracing_tutorial.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update find_cluster_export_and_explore_with_gpt.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update evaluate_toxicity_classifications.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update evaluate_summarization_classifications.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update evaluate_QA_classifications.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update evaluate_hallucination_classifications.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* Update evaluate_code_readability_classifications.ipynb

Co-authored-by: Xander Song <axiomofjoy@gmail.com>

* document breaking changes, bump langchain

* add more details to the breaking changes

* langchain bump

* fix qa evals notebook

* fix style

* update major version

* remove logging token count warnings

---------

Co-authored-by: Dustin Ngo <dustin@arize.com>
Co-authored-by: Xander Song <axiomofjoy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Support OpenAI 1.0
3 participants