This repository has been archived by the owner on Nov 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'update_pytest-html' into release/0.4.0
- Loading branch information
Showing
14 changed files
with
232 additions
and
36 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/python | ||
{ | ||
"name": "Python 3", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/python:1-3.9-bullseye" | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "pip3 install --user -r requirements.txt", | ||
|
||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PINECONE_API_KEY="<PINECONE_API_KEY>" | ||
PINECONE_ENVIRONMENT="<PINECONE_ENVIRONMENT>" | ||
OPENAI_API_KEY="<OPENAI_API_KEY>" | ||
INDEX_NAME="<INDEX_NAME>" | ||
CANOPY_CONFIG_FILE="config/config.yaml" |
This file contains 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: ✨ Feature | ||
description: Propose a straightforward extension | ||
title: "[Feature] <title>" | ||
labels: ["enhancement", "triage"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
Thanks for taking the time to fill out this feature request! | ||
- type: checkboxes | ||
attributes: | ||
label: Is this your first time submitting a feature request? | ||
description: > | ||
We want to make sure that features are distinct and discoverable, | ||
so that other members of the community can find them and offer their thoughts. | ||
Issues are the right place to request straightforward extensions of existing functionality. | ||
options: | ||
- label: I have searched the existing issues, and I could not find an existing issue for this feature | ||
required: true | ||
- label: I am requesting a straightforward extension of existing functionality | ||
- type: textarea | ||
attributes: | ||
label: Describe the feature | ||
description: A clear and concise description of what you want to happen. | ||
validations: | ||
required: true | ||
- type: textarea | ||
attributes: | ||
label: Describe alternatives you've considered | ||
description: | | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Who will this benefit? | ||
description: | | ||
What kind of use case will this feature be useful for? Please be specific and provide examples, this will help us prioritize properly. | ||
validations: | ||
required: false | ||
- type: input | ||
attributes: | ||
label: Are you interested in contributing this feature? | ||
description: Let us know if you want to write some code, and how we can help. | ||
validations: | ||
required: false | ||
- type: textarea | ||
attributes: | ||
label: Anything else? | ||
description: | | ||
Links? References? Anything that will give us more context about the feature you are suggesting! | ||
validations: | ||
required: false |
This file contains 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 |
---|---|---|
|
@@ -165,3 +165,4 @@ cython_debug/ | |
datafiles/* | ||
canopy-api-docs.html | ||
.vscode/ | ||
*.jsonl |
This file contains 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 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 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 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 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 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from .base import QueryGenerator | ||
from .function_calling import FunctionCallingQueryGenerator | ||
from .last_message import LastMessageQueryGenerator |
This file contains 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from typing import List | ||
|
||
from canopy.chat_engine.query_generator import QueryGenerator | ||
from canopy.models.data_models import Messages, Query, Role | ||
|
||
|
||
class LastMessageQueryGenerator(QueryGenerator): | ||
""" | ||
Returns the last message as a query without running any LLMs. This can be | ||
considered as the most basic query generation. Please use other query generators | ||
for more accurate results. | ||
""" | ||
|
||
def generate(self, | ||
messages: Messages, | ||
max_prompt_tokens: int) -> List[Query]: | ||
""" | ||
max_prompt_token is dismissed since we do not consume any token for | ||
generating the queries. | ||
""" | ||
|
||
if len(messages) == 0: | ||
raise ValueError("Passed chat history does not contain any messages. " | ||
"Please include at least one message in the history.") | ||
|
||
last_message = messages[-1] | ||
|
||
if last_message.role != Role.USER: | ||
raise ValueError(f"Expected a UserMessage, got {type(last_message)}.") | ||
|
||
return [Query(text=last_message.content)] | ||
|
||
async def agenerate(self, | ||
messages: Messages, | ||
max_prompt_tokens: int) -> List[Query]: | ||
return self.generate(messages, max_prompt_tokens) |
This file contains 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 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
Oops, something went wrong.