-
Notifications
You must be signed in to change notification settings - Fork 10
client: accept tool_results too #18
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
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
95afe81
feat(client): accept tool_results too
yjean f393161
fix(client): use nil for tool_results by default
yjean f4db0f0
feat(client): add tool_results documentation
yjean 4730bff
revert: tools default as [] is working
yjean 50ce83c
fix(chat-history): ensure we pass nil by default
yjean 2f1f780
fix(api): force_single_step to true
yjean 212228d
Merge branch 'main' into main
andreibondarev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ def chat( | |
stream: false, | ||
preamble: nil, | ||
preamble_override: nil, | ||
chat_history: [], | ||
chat_history: nil, | ||
conversation_id: nil, | ||
prompt_truncation: nil, | ||
connectors: [], | ||
|
@@ -34,6 +34,8 @@ def chat( | |
frequency_penalty: nil, | ||
presence_penalty: nil, | ||
tools: [], | ||
tool_results: nil, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would personally put req.body[:tool_results] = tool_results if tool_results.any? |
||
force_single_step: true, # default to true for backwards compatibility prior 6/10/2024 change | ||
&block | ||
) | ||
response = connection.post("chat") do |req| | ||
|
@@ -62,6 +64,8 @@ def chat( | |
req.body[:frequency_penalty] = frequency_penalty if frequency_penalty | ||
req.body[:presence_penalty] = presence_penalty if presence_penalty | ||
req.body[:tools] = tools if tools | ||
req.body[:tool_results] = tool_results if tool_results | ||
req.body[:force_single_step] = force_single_step | ||
end | ||
response.body | ||
end | ||
|
@@ -119,6 +123,26 @@ def embed( | |
response.body | ||
end | ||
|
||
def rerank( | ||
query:, | ||
documents: [], | ||
top_n: nil, | ||
rank_fields: nil, | ||
return_documents: nil, | ||
max_chunks_per_doc: nil, | ||
model: nil | ||
) | ||
response = connection.post("rerank") do |req| | ||
req.body = { query:, documents: } | ||
req.body[:top_n] = top_n if top_n | ||
req.body[:rank_fields] = rank_fields if rank_fields | ||
req.body[:return_documents] = return_documents if return_documents | ||
req.body[:max_chunks_per_doc] = max_chunks_per_doc if max_chunks_per_doc | ||
req.body[:model] = model if model | ||
end | ||
response.body | ||
end | ||
|
||
def classify( | ||
inputs:, | ||
examples:, | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct format? The docs mention the following format: