ExOpenAI.Searches.create_search

You're seeing just the function create_search, go back to ExOpenAI.Searches module for more information.
Link to this function

create_search(engine_id, query, opts \\ [])

View Source
This function is deprecated. Deprecated by OpenAI.

Specs

create_search(String.t(), String.t(),
  openai_organization_key: String.t(),
  openai_api_key: String.t(),
  user: String.t(),
  return_metadata: boolean(),
  max_rerank: integer(),
  file: String.t(),
  documents: [String.t()],
  stream_to: pid()
) :: {:ok, ExOpenAI.Components.CreateSearchResponse.t()} | {:error, any()}

The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them.

To go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When file is set, the search endpoint searches over all the documents in the given file and returns up to the max_rerank number of documents. These documents will be returned along with their search scores.

The similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.

Endpoint: https://api.openai.com/v1/engines/{engine_id}/search

Method: POST

Docs: https://platform.openai.com/docs/api-reference/searches


Required Arguments:

  • engine_id

Example: davinci

  • query: Query to search against the documents.

Example: the president

Optional Arguments:

  • stream_to: PID of the process to stream content to

  • documents: Up to 200 documents to search over, provided as a list of strings.

The maximum document length (in tokens) is 2034 minus the number of tokens in the query.

You should specify either documents or a file, but not both.

Example: "['White House', 'hospital', 'school']"

  • file: The ID of an uploaded file that contains documents to search over.

You should specify either documents or a file, but not both.

  • max_rerank: The maximum number of documents to be re-ranked and returned by search.

This flag only takes effect when file is set.

  • return_metadata: A special boolean flag for showing metadata. If set to true, each document entry in the returned JSON will contain a "metadata" field.

This flag only takes effect when file is set.

  • user: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.

Example: "user-1234"

  • openai_api_key: OpenAI API key to pass directly. If this is specified, it will override the api_key config value.

  • openai_organization_key: OpenAI API key to pass directly. If this is specified, it will override the organization_key config value.