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

Merge staging into main #169

Merged
merged 65 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
4a4365e
fix: code syntax highlighting to support all other languages
krushnarout Oct 25, 2024
900ae4a
Merge pull request #133 from krushnarout/fix-syntax-support
bracesproul Oct 25, 2024
d519b00
feat: address PR feedback - use initChatModel and implement configura…
ahmad2b Oct 25, 2024
78c2a26
feat: add @langchain/community for fireworks llm
ahmad2b Oct 25, 2024
a3b3902
Merge branch 'main' of https://github.com/langchain-ai/open-canvas in…
bracesproul Oct 25, 2024
9ff9ae1
cr
bracesproul Oct 25, 2024
0208017
merge staging
bracesproul Oct 25, 2024
8e0488b
cr
bracesproul Oct 25, 2024
ccd9a51
cr
bracesproul Oct 25, 2024
318b00f
cr
bracesproul Oct 25, 2024
6f4014c
Merge pull request #136 from ahmad2b/ahmad2b/customizable-model-selec…
bracesproul Oct 25, 2024
e122e44
Add Gemini 1.5 Flash to model options
mjunaidca Oct 26, 2024
900a3a4
fix: Update support for anthropic everywhere
bracesproul Oct 27, 2024
fbd294c
cr
bracesproul Oct 27, 2024
4279021
cr
bracesproul Oct 27, 2024
9791b32
move to genai
bracesproul Oct 28, 2024
a306ac2
Merge pull request #142 from mjunaidca/mjunaidca/add-gemini-1.5-flash
bracesproul Oct 28, 2024
f829417
Merge branch 'staging' into brace/use-anthropic
bracesproul Oct 28, 2024
8c4de3d
bump deps
bracesproul Oct 28, 2024
f06653b
cr
bracesproul Oct 28, 2024
61516bc
Merge pull request #145 from langchain-ai/brace/use-anthropic
bracesproul Oct 28, 2024
134e430
fix: Customize model for all requests
bracesproul Oct 28, 2024
8fb8408
cr
bracesproul Oct 28, 2024
51b3514
feat: Update font to match LangSmith
bracesproul Oct 28, 2024
614ceb4
Merge branch 'main' of https://github.com/langchain-ai/open-canvas in…
bracesproul Oct 28, 2024
2807fff
Merge branch 'staging' of https://github.com/langchain-ai/open-canvas…
bracesproul Oct 28, 2024
df26000
add tighter text
bracesproul Oct 28, 2024
679ec69
cr
bracesproul Oct 28, 2024
d9e935a
Merge pull request #156 from langchain-ai/brace/update-font
bracesproul Oct 28, 2024
c18478d
merge staging
bracesproul Oct 28, 2024
a5e1765
cr
bracesproul Oct 28, 2024
c11e50d
Merge pull request #146 from langchain-ai/brace/fix-custom-model
bracesproul Oct 28, 2024
717dba7
chore: Cleanups
bracesproul Oct 29, 2024
354c235
cleanup prop passing
bracesproul Oct 29, 2024
ceec3bc
feat: add chat feedback with thumbs up/down buttons
ahmad2b Oct 29, 2024
24bd4a8
feat: Add chat feedback only on last AI message
ahmad2b Oct 29, 2024
8904702
move components
bracesproul Oct 29, 2024
7779dd9
feat: add raw markdown view for text
listlessbird Oct 29, 2024
dad45e4
cr
bracesproul Oct 29, 2024
5d443da
Merge pull request #159 from langchain-ai/brace/cleanup-jsx
bracesproul Oct 29, 2024
e8d8e40
merge staging
bracesproul Oct 29, 2024
fed56dd
format/lint
bracesproul Oct 29, 2024
e8796d8
cr
bracesproul Oct 29, 2024
68c6f4b
Merge pull request #161 from ahmad2b/ahmad2b/add-chat-feedback
bracesproul Oct 29, 2024
4d354da
merge staging
bracesproul Oct 29, 2024
37732eb
format
bracesproul Oct 29, 2024
9f5dc01
make editable
bracesproul Oct 30, 2024
2b04198
Merge pull request #162 from listlessbird/raw-md-text
bracesproul Oct 30, 2024
099b192
fix: Set new chat true before api call returns
bracesproul Oct 30, 2024
e6303d2
Merge pull request #163 from langchain-ai/brace/reset-before-api-call
bracesproul Oct 30, 2024
8a36f43
feat: add the subgraph for generating chat titles in the background
ahmad2b Oct 30, 2024
9f941e9
feat: Add models section in readme
bracesproul Oct 30, 2024
c89f8df
Merge pull request #166 from langchain-ai/brace/models-readme-section
bracesproul Oct 30, 2024
ef620c8
cr
bracesproul Oct 30, 2024
781ec9b
cr
bracesproul Oct 30, 2024
b62c8eb
cr
bracesproul Oct 30, 2024
7a1ecb9
merge staging
bracesproul Oct 30, 2024
ebd224c
cr
bracesproul Oct 30, 2024
b325a05
Merge pull request #165 from ahmad2b/ahmad2b/background-job-chat-titles
bracesproul Oct 30, 2024
da70508
chore: Drop Llama 405b from models
bracesproul Oct 30, 2024
69967a2
Merge pull request #167 from langchain-ai/brace/remove-405b
bracesproul Oct 30, 2024
2bd7d9c
feat: Add customize model alert
bracesproul Oct 30, 2024
dfe7cbb
fade out
bracesproul Oct 30, 2024
525fabe
cr
bracesproul Oct 30, 2024
d0d6346
Merge pull request #168 from langchain-ai/brace/customize-model-alert
bracesproul Oct 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cr
  • Loading branch information
bracesproul committed Oct 28, 2024
commit a5e1765b273e1cdb8b9e07710d6e07b555399e76
29 changes: 17 additions & 12 deletions src/agent/open-canvas/nodes/rewriteArtifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ export const rewriteArtifact = async (
.describe(
"The new title to give the artifact. ONLY update this if the user is making a request which changes the subject/topic of the artifact."
),
programmingLanguage: z
language: z
.enum(
PROGRAMMING_LANGUAGES.map((lang) => lang.language) as [
string,
...string[],
]
)
.optional()
.describe(
"The programming language of the code artifact. ONLY update this if the user is making a request which changes the programming language of the code artifact, or is asking for a code artifact to be generated."
"The language of the code artifact. This should be populated with the programming language if the user is requesting code to be written, or 'other', in all other cases."
),
});
const { modelName, modelProvider } =
getModelNameAndProviderFromConfig(config);
const model = await initChatModel(modelName, {
temperature: 0,
modelProvider,
});
const toolCallingModel = model
const toolCallingModel = (
await initChatModel(modelName, {
temperature: 0,
modelProvider,
})
)
.bindTools(
[
{
Expand All @@ -71,6 +71,15 @@ export const rewriteArtifact = async (
)
.withConfig({ runName: "optionally_update_artifact_meta" });

const smallModelWithConfig = (
await initChatModel(modelName, {
temperature: 0,
modelProvider,
})
).withConfig({
runName: "rewrite_artifact_model_call",
});

const store = ensureStoreInConfig(config);
const assistantId = config.configurable?.assistant_id;
if (!assistantId) {
Expand Down Expand Up @@ -136,10 +145,6 @@ export const rewriteArtifact = async (
: ""
);

const smallModelWithConfig = model.withConfig({
runName: "rewrite_artifact_model_call",
});

const newArtifactResponse = await smallModelWithConfig.invoke([
{ role: "system", content: formattedPrompt },
recentHumanMessage,
Expand Down
2 changes: 1 addition & 1 deletion src/components/artifacts/ArtifactRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export function ArtifactRenderer(props: ArtifactRendererProps) {
? getArtifactContent(props.artifact)
: undefined;

if (!props.artifact || (!currentArtifactContent && props.isStreaming)) {
if (!props.artifact && props.isStreaming) {
return <ArtifactLoading />;
}

Expand Down
14 changes: 7 additions & 7 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const LANGGRAPH_API_URL =
process.env.LANGGRAPH_API_URL ?? "http://localhost:52375";
process.env.LANGGRAPH_API_URL ?? "http://localhost:53529";
// v2 is tied to the 'open-canvas-prod' deployment.
export const ASSISTANT_ID_COOKIE = "oc_assistant_id_v2";
// export const ASSISTANT_ID_COOKIE = "oc_assistant_id";
Expand Down Expand Up @@ -43,16 +43,16 @@ export const FIREWORKS_MODELS = [
label: "Fireworks Llama 70B",
},
{
name: "accounts/fireworks/models/llama-v3p1-8b-instruct",
label: "Fireworks Llama 8B",
name: "accounts/fireworks/models/llama-v3p1-405b-instruct",
label: "Fireworks Llama 405B",
},
];

export const GEMINI_MODELS = [
{
name: "gemini-1.5-flash",
label: "Gemini 1.5 Flash",
},
// {
// name: "gemini-1.5-flash",
// label: "Gemini 1.5 Flash",
// },
];
export const DEFAULT_MODEL_NAME: ALL_MODEL_NAMES = "gpt-4o-mini";
export type OPENAI_MODEL_NAMES = (typeof OPENAI_MODELS)[number]["name"];
Expand Down
12 changes: 3 additions & 9 deletions src/hooks/use-graph/useGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,8 @@ export function useGraph(useGraphInput: UseGraphInput) {
type: newArtifactText.type ?? "",
};
} catch (_) {
console.error(
"Failed to parse new artifact text",
generateArtifactToolCallStr
);
continue;
}
console.log("newArtifactText", newArtifactText);

if (
newArtifactText.artifact &&
Expand Down Expand Up @@ -539,7 +534,6 @@ export function useGraph(useGraphInput: UseGraphInput) {
chunk.data.name === "rewrite_artifact_model_call" &&
rewriteArtifactMeta
) {
console.log("IN THIS NODE");
if (!artifact) {
toast({
title: "Error",
Expand All @@ -557,12 +551,12 @@ export function useGraph(useGraphInput: UseGraphInput) {
if (
!artifactLanguage &&
rewriteArtifactMeta.type === "code" &&
rewriteArtifactMeta.programmingLanguage
rewriteArtifactMeta.language
) {
// If the type is `code` we should have a programming language populated
// in the rewriteArtifactMeta and can use that.
artifactLanguage =
rewriteArtifactMeta.programmingLanguage as ProgrammingLanguageOptions;
rewriteArtifactMeta.language as ProgrammingLanguageOptions;
} else if (!artifactLanguage) {
artifactLanguage =
(prevCurrentContent?.title as ProgrammingLanguageOptions) ??
Expand Down Expand Up @@ -657,7 +651,7 @@ export function useGraph(useGraphInput: UseGraphInput) {
rewriteArtifactMeta: {
type: artifactType,
title: prevCurrentContent.title,
programmingLanguage: artifactLanguage,
language: artifactLanguage,
},
prevCurrentContent,
newArtifactIndex,
Expand Down
3 changes: 2 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,10 @@ export type RewriteArtifactMetaToolResponse =
| {
type: "text";
title?: string;
language: ProgrammingLanguageOptions;
}
| {
type: "code";
title: string;
programmingLanguage: string;
language: ProgrammingLanguageOptions;
};