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

Component secret management - Update docs #6908

Closed
2 tasks
Tracked by #6846
shadeMe opened this issue Feb 5, 2024 · 3 comments
Closed
2 tasks
Tracked by #6846

Component secret management - Update docs #6908

shadeMe opened this issue Feb 5, 2024 · 3 comments
Assignees
Labels
2.x Related to Haystack v2.0 P1 High priority, add to the next sprint
Milestone

Comments

@shadeMe
Copy link
Collaborator

shadeMe commented Feb 5, 2024

Tasks

@shadeMe shadeMe added P1 High priority, add to the next sprint 2.x Related to Haystack v2.0 labels Feb 5, 2024
@shadeMe shadeMe changed the title Update docs. Component secret management - Update docs Feb 5, 2024
@shadeMe shadeMe added this to the 2.0.0-beta7 milestone Feb 5, 2024
@bilgeyucel
Copy link
Contributor

bilgeyucel commented Feb 5, 2024

Full list of affected components:
RemoteWhisperTranscriber, AzureOCRDocumentConverter, AzureOpenAIDocumentEmbedder, AzureOpenAITextEmbedder, HuggingFaceTEIDocumentEmbedder, HuggingFaceTEITextEmbedder, OpenAIDocumentEmbedder, SentenceTransformersDocumentEmbedder, SentenceTransformersTextEmbedder, AzureOpenAIGenerator, AzureOpenAIChatGenerator, HuggingFaceLocalChatGenerator, HuggingFaceTGIChatGenerator, OpenAIChatGenerator, HuggingFaceLocalGenerator, HuggingFaceTGIGenerator, OpenAIGenerator, TransformersSimilarityRanker, SearchApiWebSearch, SerperDevWebSearch.

TASK: We need to go over the documentation and fix how these components are used in code snippets and change the explanation around how to use api_key/token

Hugging Face components

SentenceTransformersDocumentEmbedder, SentenceTransformersDocumentEmbedder, TransformersSimilarityRanker and all HuggingFace* components...

  • will use HF_API_TOKEN environment variable by default if no token is passed at init
  • If users don't want to use the environment variable, this is the new way of passing token👇
document_embedder = HuggingFaceTEIDocumentEmbedder(
        model="BAAI/bge-small-en-v1.5", token=Secret.from_token("<your-api-key>")
    )

OpenAI components

RemoteWhisperTranscriber, OpenAI* generators and embedders and

  • will use OPENAI_API_KEY environment variable by default if no api_key is passed at init
  • If users don't want to use the environment variable, this is the new way of passing api_key 👇
OpenAIGenerator(api_key=Secret.from_token("<your-api-key>"), model="gpt-3.5-turbo")

Search components

SerperDevWebSearch

  • will use SERPERDEV_API_KEY environment variable by default if no api_key is passed at init
  • If users don't want to use the environment variable, this is the new way of passing api_key 👇
SerperDevWebSearch(api_key=Secret.from_token("<your-api-key>"))

SearchApiWebSearch

  • will use SEARCHAPI_API_KEY environment variable by default if no api_key is passed at init
  • If users don't want to use the environment variable, this is the new way of passing api_key 👇
SearchApiWebSearch(api_key=Secret.from_token("<your-api-key>"))

Azure Components

AzureOpenAI* generators and embedders

  • azure_ad_token_provider parameter is removed
  • will use AZURE_OPENAI_API_KEY and AZURE_OPENAI_AD_TOKEN environment variables respectively by default if no api_key and azure_ad_token are passed at init
  • If users don't want to use the environment variable, this is the new way of passing api_key 👇
    client = AzureOpenAIGenerator(azure_endpoint="<Your Azure endpoint e.g. `https://your-company.azure.openai.com/>",
                                api_key=Secret.from_token("<your-api-key>"),
                            azure_deployment="<this a model name, e.g. gpt-35-turbo>")

AzureOCRDocumentConverter

  • The environment variable for api_key is AZURE_AI_API_KEY

Additional Changes

SentenceTransformersDocumentEmbedder, SentenceTransformersTextEmbedder, HuggingFaceLocalChatGenerator and HuggingFaceLocalGenerator can no longer pass True/False to use the on-disk authentication token. See this docstring - > This might not have been documented so probably no changes needed here

@dfokina
Copy link
Contributor

dfokina commented Feb 5, 2024

All changes done @shadeMe @bilgeyucel

@dfokina dfokina closed this as completed Feb 5, 2024
@shadeMe
Copy link
Collaborator Author

shadeMe commented Feb 7, 2024

Reopening this until the Haystack concepts page and the API docs for Secret are in place.

@shadeMe shadeMe reopened this Feb 7, 2024
@dfokina dfokina closed this as completed Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Related to Haystack v2.0 P1 High priority, add to the next sprint
Projects
None yet
Development

No branches or pull requests

3 participants